Robin Thicke and Pharrell Williams were ordered to pay Marvin Gaye’s family a final judgment of nearly $5 million after a five-year legal battle over copyright infringement, according to CNN.

California U.S. District Judge John A. Kronstadt ordered Thicke, Williams and Water From Nazareth Publishing, which is owned by the producer, to jointly pay $2.9 million in damages to the Gaye family.

In addition, the Gaye family was awarded separate payments of more than $1.7 million from the singer and $357,631 from Williams and his publishing company.

In 2013, Thicke and Williams collaborated on “Blurred Lines,” a single from Thicke’s album of the same name. They were accused of copying parts of Gaye’s 1977 hit, “Got to Give It Up.”

“The last thing you want to do as a creator is take something of someone else’s when you love him.” —Pharrell Williams

Two years later, a jury ordered the frequent music collaborators to pay more than $7 million to the Gaye estate. However, they appealed the verdict and as a result, the settlement was reduced to $5.3 million.

Through the new ruling, the Gaye family will also earn 50 percent of the future royalties from “Blurred Lines.”