Prince Philip's will was ordered to remain sealed by a judge on Thursday. 

Judge Andrew McFarlane said the legal document should remain secret in order to protect the "dignity" of his widow Queen Elizabeth II, who is Britain’s head of state.

Philip died in April at the age of 99 after more than seven decades of marriage to the queen.

Wills are usually public documents in Britain, but for almost a century it has been customary for the wills of senior royals to be sealed on the order of the High Court.

Judge McFarlane said Philip’s will should be sealed for 90 years. After that, it can be opened in private and consideration given to whether it should be published.

PRINCE PHILIP, DUKE OF EDINBURGH AND QUEEN ELIZABETH II'S HUSBAND, DEAD AT 99

"I have held that, because of the constitutional position of the Sovereign, it is appropriate to have a special practice in relation to royal wills," McFarlane said in a written judgment. "There is a need to enhance the protection afforded to truly private aspects of the lives of this limited group of individuals in order to maintain the dignity of the Sovereign and close members of her family."

A judge ruled Thursday Sept. 16, 2021, that the will of the late Prince Philip should remain secret to protect the "dignity" of his widow Queen Elizabeth II, who is Britain’s head of state.

A judge ruled Thursday Sept. 16, 2021, that the will of the late Prince Philip should remain secret to protect the "dignity" of his widow Queen Elizabeth II, who is Britain’s head of state. (AP Photo/Matt Dunham, File)

The judge stressed that he had not seen or been told of the contents of the will.

McFarlane said that as president of the High Court’s family division, he is custodian of a safe which holds 30 envelopes, each containing the sealed will of a deceased royal, including the late Queen Mother Elizabeth and the current queen’s sister, Princess Margaret. Both died in 2002.

PRINCE PHILIP'S CAUSE OF DEATH REVEALED BY QUEEN ELIZABETH'S PHYSICIAN

In the years that followed, a man who claimed to be Margaret’s illegitimate son, Robert Brown, fought a failed court battle to have both wills unsealed in order to seek evidence for his claim.

The judge said that while there might be "public curiosity" about royal wills, "there is no true public interest in the public knowing this wholly private information."

CLICK HERE TO GET THE FOX NEWS APP

The ruling came after a court hearing in July that was held in private. Media organizations were not allowed to make the case for publishing the will.

The Associated Press contributed to this report.