The Duke of York has said he is "grateful" for an apology from police after officers challenged him in the gardens of Buckingham Palace.
In a statement, Prince Andrew said the police had a difficult job and sometimes they "get it wrong".
Scotland Yard confirmed it had stopped the prince and said the force had "apologised for any inconvenience".
The incident happened two days after a man was arrested on suspicion of burglary inside the palace.
The duke said: "The police have a difficult job to do balancing security for the Royal Family and deterring intruders, and sometimes they get it wrong.
"I am grateful for their apology and look forward to a safe walk in the garden in the future."
'No weapons drawn'
Police said no weapons were drawn in the incident involving the duke, who is the Queen's second son and has an apartment and office at Buckingham Palace.
The Sunday Express earlier reported officers pointed their guns and ordered him to "put your hands up and get on the ground" after mistaking him for an intruder.
The Metropolitan Police said in a statement: "In light of media reports we can confirm that the man spoken to by officers was the Duke of York. We are making this public with HRH's permission.
"We are grateful to the duke for his understanding and have apologised for any inconvenience caused."
The Express said an internal inquiry into the incident was being carried out, but the palace has made no comment.
The duke had earlier attended an engagement in Piccadilly, central London, supporting new business ventures.
Security is being reviewed at the palace after Monday's suspected break-in, in which an intruder was able to scale a fence and get inside the palace.
Police said a man was arrested inside the palace on suspicion of burglary, trespass and criminal damage at about 22:20 BST.
He was found "in an area currently open to the public during the day".
A second man was arrested outside on suspicion of conspiracy to commit burglary. Both men were bailed.
"A review of the specific circumstances of this incident is being carried out," a Met spokesman said.
The Queen and Prince Philip have been at Balmoral Castle since the beginning of August and they are not expected to return to the palace until October.
Buckingham Palace is the best known of the Queen's three official residences, serving as a family home and the administrative headquarters of the monarchy.
Security has been breached on a number of occasions at the palace, most famously in 1982 when Michael Fagan broke into the Queen's bedroom.
The monarch woke to find Fagan, 30, sitting on her bed.