A conservative US think tank urged a federal judge on Tuesday to order the release of the immigration records of Britain's Prince Harry, who was awarded a visa despite the admission in his memoir that he had used illegal drugs.

Lawyers for the Washington-based Heritage Foundation are seeking the release of the records from the Department of Homeland Security (DHS) under the Freedom of Information Act (FOIA).

"This is obviously a case about Prince Harry," Samuel Dewey, a lawyer for the Heritage Foundation, said at the hearing. "But it's truly about DHS and its compliance to the law."

The 38-year-old Harry was not in court -- he was in London's High Court on Tuesday complaining about the "incredibly invasive" media coverage that he has endured from the British press.

The younger son of Britain's King Charles III accuses Mirror Group Newspapers -- publisher of The Mirror, Sunday Mirror and the Sunday People tabloids -- of illegal information gathering, including phone hacking.

Harry and his wife, Meghan Markle, an American citizen, moved to the United States in January 2020 after stepping away from their royal duties.

In the complaint being heard here in US District Court, the Heritage Foundation noted that Harry "has publicly admitted to the essential elements of a number of drug offenses in both the United States and abroad."

"United States law generally renders such a person inadmissible for entry to the United States," the complaint says.

In his book "Spare," Harry admitted to experimenting with drugs including marijuana, cocaine and psychedelics.

In arguing for the release of Harry's immigration file, the Heritage Foundation said there is "widespread public and press interest" in the case.

The Heritage Foundation noted that other celebrities such as the late football star Maradona and the late singer Amy Winehouse had been denied entry into the United States because of past drug use.

In its response, the government said that while there "may be some public interest in the records sought," it is not presently convinced there is a compelling need to release the records.

Two branches of the DHS have previously declined to release the prince's immigration file without his consent.

Visa applicants to the United States are asked about their past drug use and can be barred from entry, although there are exceptions and waivers can be granted.

Judge Carl Nichols gave the DHS until June 13 to come up with a response to the records request.