Prince Harry lost his battle for publicly funded protection in Britain.

On Wednesday, a London judge ruled that the U.K. government did not act irrationally in deciding to strip the Duke of Sussex of security privileges after he stepped back as a senior royal in 2020 and moved to the U.S. A spokesperson for the 39-year-old said that he plans to appeal the ruling. 

The decision was made by the Royal and VIP Executive Committee (RAVEC). The group is made up of members of the royal family staff, the Metropolitan Police, as well as several government offices.

PRINCE HARRY WOULD NEVER 'TWIST THE KNIFE' IN ROYAL FAMILY WITH U.S. CITIZENSHIP, EXPERT CLAIMS

Prince Harry looks serious as he walks in a dark suit and tie

Prince Harry plans to appeal the High Court judge's ruling. (Wiktor Szymanowicz/Anadolu Agency)

"The duke is not asking for preferential treatment, but for a fair and lawful application of RAVEC’s own rules, ensuring that he receives the same consideration as others in accordance with RAVEC’s own written policy," his spokesperson said in a statement.

High Court Judge Peter Lane said the February 2020 decision was not unlawful, irrational or unjustified.

"Insofar as the case-by-case approach may otherwise have caused difficulties, they have not been shown to be such as to overcome the high hurdle so as to render the decision-making irrational," Lane wrote in the 51-page ruling.

Prince Harry and Meghan Markle arrive at an event in New York City

The Duke and Duchess of Sussex stepped back as senior royals in 2020. (REUTERS/Mike Segar)

The younger son of King Charles III claimed in his lawsuit that he and his family were endangered when visiting his home country because of hostility toward him and his wife, Meghan Markle. He pointed out that the couple had been faced with ruthless hounding by the U.K. news media.

In response, a government lawyer said Harry had been treated fairly and was still provided protection on some of his visits. The lawyer cited a security detail that guarded the prince in June 2021, when he was chased by photographers after attending an event with seriously ill children in west London.

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Prince Harry looking away inside his car

The Duke of Sussex leaving Kew Gardens, London, after attending the WellChild Awards on June 30, 2021. (Aaron Chown/PA Images via Getty Images)

The committee considered the wider impact that the "tragic death" of his mother, the late Princess Diana, had on the nation, and in making its decision, gave greater weight to the "likely significant public upset were a successful attack" on her son to happen, attorney James Eadie said.

The glamorous mother of Harry and his older brother Prince William died in 1997 at age 36 in Paris. At the time, she was being chased by paparazzi.

Markle, a former American actress, became the Duchess of Sussex when she married the British prince in 2018. They stepped down as working royals in 2020, citing what they described as unbearable intrusions and racist attitudes of the British media.

CLICK HERE TO GET THE FOX NEWS APP

Prince Harry and Meghan Markle smile as senior royals

Meghan Markle, a former American actress, became the Duchess of Sussex when she married the British prince in 2018. (Chris Jackson)

LIKE WHAT YOU’RE READING? CLICK HERE FOR MORE ENTERTAINMENT NEWS

Harry’s lawyers previously said the prince was reluctant to bring the couple’s children, Prince Archie, 4, and Princess Lilibet, 2, to the U.K. because it is not safe. 

Harry argued his private security team in the U.S. does not have adequate jurisdiction abroad or access to U.K. intelligence information. His lawyers also said that removing his full royal security was unreasonable because Harry was not allowed to make "informed representations beforehand."

The British government said the committee’s decision was reasonable, and it is not possible to pay privately for police protection.

The Duke and Duchess of Sussex reside in California.

The Associated Press contributed to this report.