The Cabinet Office has lost its legal challenge to the UK Covid-19 Inquiry chairwoman’s request for Boris Johnson’s unredacted WhatsApp messages, notebooks and diaries.

The department brought legal action over inquiry chairwoman Baroness Heather Hallett’s order to release the documents, arguing it should not have to hand over material that is “unambiguously irrelevant”.

In a ruling on Thursday, Lord Justice Dingemans and Mr Justice Garnham dismissed the claim for judicial review, but said the Cabinet Office could make a different application to Lady Hallett.

The judges said: “The diaries and notebooks sought were very likely to contain information about decision making relating to the Covid-19 pandemic and therefore ‘relate to a matter in question at the inquiry’,”

At a hearing last month, lawyers for the department argued the inquiry does not have the legal power to force ministers to release documents and messages it says cover matters “unconnected to the Government’s handling of Covid”.

Read More: Patrick Harvie: Ceremony for King an 'overpriced Game of Thrones cosplay exercise'

However, Hugo Keith KC, for the inquiry chairwoman, said the idea that the Cabinet Office could decide which aspects were relevant “would emasculate this and future inquiries”.

And Lord David Pannick KC, on behalf of the former prime minister, argued there is a “real danger” of undermining public confidence in the process if the department wins its bid.

The Government took the highly unusual step of launching the challenge in June, in a move which attracted criticism after days of public wrangling between the Cabinet Office and Lady Hallett’s probe.

The former prime minister handed over his unredacted WhatsApp messages, diaries and 24 notebooks to the Cabinet Office in late May.

Mr Johnson himself backed Lady Hallett, who rejected the argument that the material was irrelevant in a May ruling, in opposing the legal challenge over the request.