The Duke of York said he is "grateful" for an apology from police after officers challenged him in Buckingham Palace gardens less than 48 hours after a break-in at the Queen's home.
The Metropolitan Police confirmed a man was ordered to verify his identity by two officers around 6pm on Wednesday.
Prince Andrew 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."
The confrontation came after an intruder was able to scale a fence and get inside the palace last Monday night, before being arrested by police.
A police spokesman said no weapons had been drawn and no force was used.
"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," said a police spokesman.
"We are grateful to the Duke for his understanding and have apologised for any inconvenience caused."
A security review has been launched following the earlier suspected burglary, when police said a man was found shortly before 10.30pm "in an area currently open to the public during the day" and arrested for burglary, trespass and criminal damage.
A second man was arrested outside the palace for conspiracy to commit burglary. Both men have been bailed to return to a central London police station while inquiries continue.
"A review of the specific circumstances of this incident is being carried out. No members of the royal family were at Buckingham Palace at the time of the incident," police added.