A man who scaled a Buckingham Palace fence has been spared jail by a judge who told him he was lucky not to have been killed by police.
Cameron Kalani, 44, entered the Royal Mews – which houses the royal family's horses – in the early hours of May 10 last year.
He was caught with a 20cm kitchen knife and cocaine in his bag when he was arrested after climbing back into Buckingham Palace Road.
Kalani was handed a 24-week prison sentence, suspended for 12 months, at Westminster Magistrates' Court on Tuesday. He previously pleaded guilty to trespassing on a protected site, possession of a bladed article and possession of a wrap of cocaine.
Deputy District Judge Roy Brown told him: "You are a very fortunate man indeed.
"It is just good luck and good fortune that neither you nor anyone else was either seriously injured or killed in the course of your escapade in May last year.
"The police were extremely restrained in the way they behaved with you in the face of an ongoing threat."
Prosecutor Alexander Alawode told the court Kalani was captured on CCTV at around 4.30am climbing over the fence into the Royal Mews and trespassing on the grounds.
"He was then observed climbing over the fence back into Buckingham Palace Road before being detained around 10 minutes later outside the Royal Mews by palace police officers," he said.
"He seemed very confused."
The court heard friends say that Kalani is a talented wildlife photographer with a keen interest in mathematics and physics who has never shown any interest in the royal family.
In his basis of plea he said he had travelled to London from his home in Haywards Heath, West Sussex, while in a state of psychosis in a bid "to be arrested".
Kalani, who was supported in court by his mother and aunt, said he had packed his bag with a knife in an envelope and the drugs, scaling the fence after seeing a sign reading: "Do not climb".
"I did not know the fence was attached to or formed part of the Buckingham Palace estate," he said.
"My sole intention was to be arrested. I did not seek to do anyone harm or damage any property."
Ben Lay, defending, said his client was in a "severe mental health crisis, an episode of psychosis" at the time of the offences.
"In that state, Mr Kalani's only intention was to get help and thought the best way to do this was to get arrested."
The judge said he did not accept Kalani had carried the knife and drugs "simply to get arrested", adding: "There are easier locations to attend if you want to draw the attention of the police."
But he added: "Your behaviour at that time was largely due to your psychiatric state."
As part of Kalani's suspended sentence, he must attend a 30-day rehabilitation programme and cannot enter the SW1A postal area. He was also ordered to pay £213 costs.
Mr Brown told him: "Behave yourself and you won't go to prison."
For more stories from where you live, visit InYourArea.