The Ingenious Group, which ran a film investment firm backed by entertainment industry figures including David Beckham, Sacha Baron Cohen and “Harry Potter” producer David Heyman, has won a £700 million ($975 million) appeal against Her Majesty’s Revenue and Customs (HMRC).

The case dates back to the early 2000s when something called “sideways loss relief” was still permitted. This enabled top rate earners, who would otherwise be taxed 40% on the top chunk of their incomes, to offset their potential tax bill against losses they made in other areas of business.

Ingenious therefore created film finance partnership schemes – which funded some of the world’s most successful films, including “Avatar” and “Life of Pi” – but any losses that the schemes made could be used to significantly offset investors’ tax bills.

HMRC claimed the schemes artificially invented losses on profitable films and amounted to “tax avoidance.” The schemes “sought to use artificial losses arising from investments to avoid £568 million of tax,” HMRC said in one press release from 2016. “The Ingenious scheme tried to use artificial losses arising from investments in a range of films, including the blockbusters ‘Avatar,’ ‘Life of Pi’ and ‘Die Hard 4.'”

Ingenious, however, contended the schemes simply enabled “tax deferral,” pointing out that once the investment partnerships began making money, investors would end up paying the top rate of tax.

The case, which could potentially have cost Ingenious up to £700 million ($975 million) taking into account interest, has been running since 2014. Ingenious lost three senior staff in the same year: chief executive James Clayton, media division managing director Nik Bower and investment director Michael Shyjka, although a spokesperson for the company said at the time: “None of our recent departures have anything to do with the [HMRC] hearing whatsoever. The timing of their departure is pure coincidence.”

After going on to lose a 2016 judgment and 2019 judgment in the lower courts, the Court of Appeal this week found in favor of Ingenious, declaring that the partnerships were trading with a view to profit (and therefore did not amount to tax avoidance). The court also ordered HMRC to pay Ingenious’s costs and barred them from appealing to the Supreme Court.

“We are very pleased that the Court of Appeal reversed the findings of the Upper Tier Tribunal and ruled that our film partnerships were, as we have always contended, trading with a view to profit,” said a spokesperson for Ingenious. “In light of this judgment we are considering what further options are open to us in relation to these proceedings.”

Ingenious continues to operate a film finance fund, funding around 30 films a year. Recent hits have included “Judy,” for which Renee Zellweger won an Academy Award, and “Unhinged” with Russell Crowe.