Pharrell Williams and Robin Thicke have been ordered to pay a total of nearly $5m (£3.9m) to the family of Marvin Gaye, in a final judgment in the plagiarism case that found similarity between their song Blurred Lines and Gaye’s song Got to Give It Up.

Blurred Lines reached No 1 in the US and UK in 2013, becoming Thicke’s biggest hit to date, eventually generating a total of $16.6m in revenue (with Thicke and Williams earning $5m each). In August of that year, following an accusation by the Gaye family that the song borrowed from Got to Give It Up, Thicke and Williams filed a lawsuit to try and affirm that their song did not infringe copyright.

The Gaye family, who own the copyright to their father’s songs, countersued, resulting in a legal battle that initially concluded in March 2015, with a judge ruling in favour of the family – Thicke and Williams were ordered to pay $7.4m.

The sum was later reduced but the pair still appealed in 2016. Earlier this year, a judge upheld the original ruling, resulting in this new amended judgment. The pair must jointly pay $2.8m, with Thicke also paying an additional $1.7m and Williams $357,630, while 50% of future royalties from the song will also be paid to the Gaye family.

The judgment has been controversial, with Williams arguing for “Feel. Not infringement” while testifying that he had evoked the mood of Gaye’s song without directly plagiarising it. Thicke had previously admitted to the inspiration in a GQ interview, saying: “I was like, ‘Damn, we should make something like that, something with that groove.’ Then [Williams] started playing a little something and we literally wrote the song in about a half-hour and recorded it.”

The appeal decision was upheld by two judges against one – the latter, Jacqueline Nguyen, argued that the songs “differed in melody, harmony and rhythm” and said the verdict “strikes a devastating blow to future musicians and composers everywhere”.