Harry was at the Royal Courts of Justice in London last week for the latest stage of a legal battle with the Home Office over the level of taxpayer-funded personal security he should receive when visiting the UK.
In February 2020, the Executive Committee for the Protection of Royalty and Public Figures (RAVEC) decided he should receive a different degree of protection when in the country, and he is appealing against a High Court ruling dismissing his case against the Home Office over the decision.
A summary of evidence heard in private during Harry's appeal case last week reveals the duke had requested protection following a threat from terrorists.
"The appellant confirmed that he had requested certain protection after a threat was made against him by al-Qaeda," the document says.
Harry has previously said he faces a greater risk than his late mother, Diana, with "additional layers of racism and extremism".
In written submissions, Shaheed Fatima KC, for the duke, said RAVEC ruled in 2020 that "there is no basis for publicly funded security support for the duke and duchess within Great Britain".
After the decision, al-Qaeda called for Harry "to be murdered", and his security team was informed that the terrorist group had said his "assassination would please the Muslim community", Fatima said.
The Home Office, which is legally responsible for RAVEC's decisions, is opposing the appeal.
Harry and Meghan announced they were stepping back from official public duties on 2020.
The duke and duchess were later told they would not retain full-time police protection, which is granted to the King and Queen, the Prince and Princess of Wales and their three children.
RAVEC's decision stated that police protection would no longer be appropriate after the Sussexes' departure.
They would instead receive a "bespoke" security service, whereby they would be required to give 30 days' notice of plans to travel to the UK, with each visit being assessed for whether protection is needed.
Fatima told the appeal hearing the duke had been "singled out for different, unjustified and inferior treatment", adding Harry "does not accept that 'bespoke' means 'better'."
A decision is expected at a later date.