The UK government acted unlawfully in awarding a £560,000 contract to a research firm with links to Dominic Cummings, former chief adviser to Prime Minister Boris Johnson, the High Court has ruled.

The Cabinet Office, overseen by chancellor of the Duchy of Lancaster Michael Gove, awarded the contract to Public First, a policy and research company run by James Frayne and Rachel Wolf, in March 2020.

The duo have links to Cummings, who left his role advising the prime minister last November, and connections to the Tory party. Frayne worked for Gove when he was education secretary while Wolf co-wrote the Conservative party’s 2019 general election manifesto.

The Good Law Project, a campaign group which has brought a number of legal claims against the government over procurement processes, claimed there was bias or apparent bias in the award of the six-month contract to test the opinions of focus groups towards government policy. It alleged that the contract was directly awarded to Public First because “Dominic Cummings wanted Public First to have the contract”.

It claimed that Cummings’ longstanding links with Wolf and Frayne meant he should have recused himself from the decision-making process.

On Wednesday the High Court ruled that the decision to award the contract gave rise to apparent bias. Mrs Justice Finola O’Farrell accepted that the government was entitled to award the six-month contract to Public First on the grounds that the work was necessary.

However, she found that the government’s failure to consider any other research agency to do the work “would lead a fair minded and informed observer to conclude there was a real possibility or a real danger that the decision maker was biased”. She ruled that the Good Law Project had established its legal case that the decision to award the contract to Public First gave rise to apparent bias and was unlawful.

O’Farrell ruled that Cummings’ connections with Public First did not preclude him from involvement in the contract award but said “it was incumbent on those involved in the appointment of Public First to ensure there was a clear record of the objective criteria” used to select the firm so they could “allay any suspicion of favourable treatment based on personal or professional friendships”.

During the High Court hearing earlier this year, the Good Law Project argued that the contract award had caused consternation among Cabinet Office officials highlighting one email in which a civil servant referred to Public First as “this agency is the one who are Dominic Cummings/Lee Cain’s mates“.

The UK government denied the claims of apparent bias in the award of the contract. In a witness statement given to the court, Cummings denied the contract had been awarded because of his connections and said he had not met Frayne since 2016.

Jo Maugham, director of the Good Law Project, welcomed Wednesday’s court ruling: “Government has claimed there was no favouritism in the awarding of contracts. But the High Court has held that an informed observer would conclude otherwise.”

Public First said it was “deeply proud” of its work and the High Court had made no criticism of it whatsoever. “The judge rejected most of the Good Law Project’s claims, not finding actual bias in the awarding of this work, nor any problems with the pace or scale of the award. Rather, the judge found that weak internal processes gave rise to the appearance of bias,” the firm said.

The Cabinet Office said: “The judgment makes clear that there was no suggestion of actual bias and that the decision to award the contract was not due to any personal or professional connections. Procedural issues raised in this judgment have already been addressed through the implementation of the independent Boardman review of procurement processes.”

Cummings responded to the ruling on Twitter and predicted the ruling would mean an increase in government paper trails to cover future legal proceedings. He tweeted: “Court is telling SW1 [Westminster]: even in a crisis like a once-a-century pandemic, your real focus should always be the paper trail.”