The Duke of Sussex has lost his High Court challenge against the Home Office over a decision to change the level of his personal security when he visits the UK.

Harry took legal action over the February 2020 decision of the Executive Committee for the Protection of Royalty and Public Figures (Ravec) after being told he would no longer be given the “same degree” of publicly-funded protection when in the country.

Ravec’s decision came as a result of a change in the duke’s “status” after he stopped being a “full-time working member of the royal family”, a judge was told.

At a hearing in London in December, the US-based duke’s lawyers said he was “singled out” and treated “less favourably” in the decision by the body that falls under the remit of the Home Office.

They said a failure to carry out a risk analysis and fully consider the impact of a “successful attack” on him meant the approach to his protection was “unlawful and unfair”.

The Government said Harry’s claim should be dismissed, arguing Ravec was entitled to conclude the duke’s protection should be “bespoke” and considered on a “case-by-case” basis.

In a ruling on Wednesday, retired High Court judge Sir Peter Lane rejected the duke’s case and concluded Ravec’s approach was not irrational nor procedurally unfair.

In his 52-page partially redacted ruling, Sir Peter said Harry’s lawyers had taken “an inappropriate, formalist interpretation of the Ravec process”.

He added: “The ‘bespoke’ process devised for the claimant in the decision of 28 February 2020 was, and is, legally sound.”

The judge said he accepted comments from Sir Richard Mottram, the former chairman of Ravec, who said that, even if he had received a document setting out all of Harry’s legal arguments in February 2020, “I would have reached the same decision for materially the same reasons”.

Ravec has delegated responsibility from the Home Office over the provision of protective security arrangements for members of the royal family and others, with involvement from the Metropolitan Police, the Cabinet Office and the royal household.

Harry, who was not present at the December hearing, lives in North America with wife Meghan and their children after the couple announced they were stepping back as senior royals in January 2020.

His lawyers told the judge in December that Harry believes his children cannot “feel at home” in the UK if it is “not possible to keep them safe” there.

The majority of the proceedings were held in private, without the public or press present, because of confidential evidence over security measures for Harry and other public figures.

Sir Peter said his ruling contained redactions because if such information was made public it would have “a serious adverse impact on the individuals concerned, as well as being contrary to the public interest, including that of national security”.

Home Office lawyers had argued that the duke was no longer a member of the group of people whose “security position” was under regular review by Ravec, but he was “brought back within the cohort in the appropriate circumstances”.

The court was told it was “simply incorrect” to suggest there was no evidence that the issue of impact was considered, adding that the death of Diana, Princess of Wales – Harry’s mother – was raised as part of the decision.

Following the ruling, a Home Office spokesperson said: “We are pleased that the court has found in favour of the Government’s position in this case and we are carefully considering our next steps.

“It would be inappropriate to comment further.

“The UK Government’s protective security system is rigorous and proportionate.

“It is our long-standing policy not to provide detailed information on those arrangements, as doing so could compromise their integrity and affect individuals’ security.”