The Electoral Commission let Vote Leave break EU referendum spending laws because the watchdog misinterpreted them, the High Court has ruled.
Vote Leave paid £625,000 to clear bills allegedly run up by university student Darren Grimes.
The watchdog initially said it had no grounds to suspect this was a scheme to get round spending limits.
It later changed its mind and fined Vote Leave and Mr Grimes – and also referred him to the police.
Mr Grimes and Vote Leave deny wrongdoing – they claim they were acting on advice from the Electoral Commission.
In his judgement, Lord Justice Leggatt said the Electoral Commission had “misinterpreted the definition of ‘referendum expenses'” as defined by the Political Parties, Elections and Referendum Act.
He added: “The source of its error is a mistaken assumption that an individual or body which makes a donation to a permitted participant cannot thereby incur referendum expenses.
“As a result of this error, the Electoral Commission has interpreted the definition in a way that is inconsistent with both the language and the purpose of the legislation.”
Vote Leave’s donation to Mr Grimes, which went straight to its Canadian digital agency AggregateIQ, should have counted as part of Vote Leave’s campaign expenses, added the judge.
“The position would have been different if the money had been given to Mr Grimes for him to use however he chose in promoting a ‘leave’ outcome of the referendum,” he added.
But the judge said there was no “rational basis” for the watchdog’s actions, which he described a “recipe for abuse” of the law.
The Electoral Commission said it welcomed the the High Court’s “consideration of this aspect of electoral law”.
“The court arrived at the same conclusion as the Commission did in its investigation – that Vote Leave should have accounted for the expenditure on the digital services firm, AggregateIQ – although it found an additional reason for reaching that conclusion.
“The Commission imposed sanctions on Vote Leave for this offence and others found during the investigation.”
But Jolyon Maugham QC of the Good Law Project, which brought the High Court challenge, said the ruling proved the watchdog “unlawfully tilted the playing field in favour of Leave” in the 2016 referendum.
“Stronger In (the official Remain campaign) was also up against its spending limits.
“But because it didn’t get the advice from the Electoral Commission it had to stop spending. And the High Court decided that advice was wrong.”
He said “heads should roll” at the Electoral Commission over the error.
Matthew Elliott, former chief executive of Vote Leave, said the High Court ruling had “thrown electoral law for future elections and referendums into total chaos”.
“Either the Electoral Commission is wrong or the High Court is wrong.
“Should the Electoral Commission choose not to appeal this judgment, they will be admitting that they gave Vote Leave incorrect advice and they should immediately reconsider the unfair fines they are seeking to impose on us,” he added.
“Vote Leave would not have made the donations that it did, had it not been for the Commission’s clear advice.
“This whole situation is a mess of the Electoral Commission’s own making, and their defeat in the High Court today must force a rethink.
“They now have a chance to rectify their errors. They should do the right thing.”
Electoral Commission got Brexit law wrong over Vote Leave, court rules}