The 90-year-old monarch was known for her fondness of long walks in the garden in the past and often when she struggled to sleep she decided to take a stroll.
However, on one occasion, a former guardsman revealed how he was caught unawares at 3 am at Buckingham Palace in London.
"Bloody hell, Your Majesty, I nearly shot you," the anonymous guard is reported to have said.
"Next time I'll ring through beforehand so you don't have to shoot me."
More From This Section
Buckingham Palace has declined to comment on the anecdote.
It is believed the incident occurred several years ago and that the Queen is now unlikely to be found on similar walks late in the night due to her age.
In 2013, her younger son Prince Andrew was mistaken for an intruder and confronted by armed police as he walked in the Buckingham Palace garden.
Police said no weapons were drawn but it issued an apology to the prince.
In August 2016, a 22-year-old man was arrested at 4 am after he climbed over a security fence and was being spotted by officers monitoring CCTV.
And in May 2016, 41-year-old Denis Hennessy climbed over barbed wire and roamed freely in the palace grounds for 10 minutes while the Queen, Prince Philip and Prince Andrew were in residence, before the intruder was arrested.
In 2013, a man scaled the fence and was found after 10 pm in one of the State Rooms.
None of the royals were in residence at the time.
She is once believed to have chatted away with a group of tourists, who had not recognised her during a paid visit to see parts of Buckingham Palace.
The Queen did not want to blow her cover, so she played along.