Nigel Farage has been handed a victory by the European court of justice, after judges found a political group he fronted had been unfairly treated over a demand to repay EU funds.

The ECJ’s general court found that “appearances of impartiality were seriously compromised”, when a panel of MEP leaders decided in November 2016 that a Ukip-dominated group should be asked to repay €173,000 (£148,000) and denied a further €501,000 in EU grant money.

The court judged that the bureau of the European parliament failed to guarantee impartiality, because a vice-president of the parliament at the time claimed publicly there had been “fraudulent use of funds” before any official decision had been taken.

Ulrike Lunacek issued a press release and social media comments on the case, before she joined the 15-person bureau of MEP leaders to consider a report by the parliament’s financial controllers. “It takes exceptional nerve to disparage the EU at every opportunity while illegally cashing in on EU funds,” the Austrian Green MEP tweeted, before entering the meeting. In reply to a social media user, she also claimed that “fraudulent use of funds” had taken place.

Judges decided that she had “prejudged the issue before the contested decision relating to the 2015 financial year was adopted”, a problem that was magnified as minutes revealed she was the only MEP to speak on the case during the meeting. Lunacek left the parliament in 2017 for unrelated reasons.

“The parliament must provide sufficient guarantees to rule out any doubt over the lack of bias of its members when taking administrative decisions,” the court said.

The court also rejected the parliament’s claim that the Ukip-dominated Alliance for Direct Democracy in Europe (ADDE) had broken EU spending rules by spending public funds on an opinion poll before the 2016 Brexit referendum. The poll was conducted in seven member states including the UK, but the court decided that apart from the latter the spending had fallen within the rules.

Pan-European political parties and groups can use EU funds for research and policy work, but not for campaigning in national elections and referendums.

The decision is a significant public relations victory for anti-EU parties and will likely be used to fuel their narrative that EU institutions are biased against them.

But the ADDE, whose legal team included the Belgian lawyer and Eurosceptic politician Mischaël Modrikanen, were not vindicated on all points.

The court upheld the parliament’s decision to demand a bank guarantee and restrict advance payments to the ADDE after the 2016 decision. This provision was deemed a reasonable way to protect the EU’s financial interests, as there was a risk the ADDE could go bankrupt over the demands for repayment.

The court also rejected the ADDE’s claim that the bureau of the European parliament was inherently biased because it has no anti-EU members. The court decided that the body represented the parliament, because it was elected by MEPs.

Eurosceptic parties usually struggle to win leadership positions in the parliament, as they are blocked by the pro-EU majority.

As both sides lost some legal arguments, the court ordered each party to bear their own costs.

Responding to the court ruling, Farage said: “The politically motivated bias in this case was so outrageous that even the EU’s own court had to pull the thuggish European parliament off the Eurosceptic parties group. The European parliament likes to talk about the rule of law but when there is a chance it will act tyrannically to crush its political opposition.”

He added: “I am glad this blatant bias by the European parliament has been called out by the ECJ, but experience tells me that the EU will continue to persecute nation state democrats as cruelly and unfairly as it can.”

The European parliament declined to comment.