Galway Girl Ed Sheeran
A man turned up at Buckingham Palace within hours of killing a stranger and demanded to see the Queen, the Old Bailey heard.
Ghodratollah Barani strangled rough sleeper Mark Morrison, 46, and spent the next week repeatedly trying to see the Queen,
He said he had been hearing voices telling him to kill someone so he could be king and that the Queen would help him.
Barani had been to the palace before the killing and was twice taken to hospital but doctors thought he was faking illness to further his asylum application.
After being turned away from the palace on June 21 last year, he went to Marble Arch in central London, and strangled Mr Morrison with a green cord in the middle of the night.
He was arrested on June 29, after he was linked to the killing, when he spoke to police and soldiers in Horseguards Parade, the court heard.
The 27-year-old Afghan, who lived in Sheffield before arriving in London, pleaded guilty to manslaughter on the grounds of diminished responsibility.
He was ordered to be detained in a secure hospital without limit of time.
Former chef Mr Morrison, who was born in Dunblane, had been sleeping on a bench at Marble Arch since being made homeless a few months before.
Judge Christopher Moss criticised doctors who examined Barani before the killing.
"I have no doubt from what I have read and heard that (the death) was entirely preventable."
The judge said he was satisfied Barani had been suffering from schizophrenia, although doctors had not diagnosed it.
Judge Moss told Barani:
"Voices were telling you you had to kill someone in order to become king, that you had to kill in order to become king of England.
"After the killing, the voices told you to return to Buckingham Palace saying you will be king of England."
When he was stopped at the north gate of Buckingham Palace, he said he was the king of Afghanistan.
Barani had been taken to St Thomas' and Gordon hospitals after two previous attempts to enter the palace.
The judge continued:
"You were taken to hospital and despite telling doctors you were trying to seek refuge there and wanted to see the Queen, you were not diagnosed with mental illness."
He said that "bizarrely" on another occasion, he was turned away from St Thomas' A&E department despite saying he had thoughts of killing someone in order to become king.
Zoe Johnson, prosecuting, said doctors believed his claims were linked to his asylum claim.
Miss Johnson said Barani first appeared outside the palace in the early hours of June 17.
"When he was spoken to by police he said he was the king and wanted to enter his palace.
"It seems a pattern emerges of Mr Barani returning to Buckingham Palace. The following day, June 18, he was stopped at the north gate. He claimed to be the king of Afghanistan.
"He was taken to St Thomas's. Doctors examined him and decided he was suffering from 'situational crisis' because he was homeless and was waiting for adjudication of his asylum claim."
The next day, June 19, he returned to hospital complaining of back pain. One June 20, he went there again and was again discharged.
One June 21, he went to the front of Buckingham Palace and was "rather more determined".
Miss Johnson continued:
"He grabbed the gate and would not let go. He demanded it should be opened."
He was restrained by police and was escorted away by trained officers.
Despite telling them he was the king of Afghanistan and was hearing voices, they did not think he was mentally ill after he told them he was an asylum seeker.
They decided to refer him to social services and took him to Victoria station for a cup of coffee.
But Barani ran off and went back to the palace and again demanded to be let in, said Miss Johnson.
He was then taken by police to the Gordon Hospital in Pimlico, and was seen by "a number of doctors over a number of hours" but it was decided "there were no grounds to admit him".
After being released in the evening, Barani returned to the palace, said he wanted to see the Queen, and was asked to leave.
It was then he went to Marble Arch and killed Mr Morrison a few hours later in the early hours of June 22.
Miss Johnson said later that day, Barani returned to the palace again.
"He said he was the king of Afghanistan and needed to see the Queen because he had some problems she could solve."
The police, unaware of his connection to the killing, issued him with an exclusion order from the Royal Parks. He breached the order and was arrested but released.
On June 24 he was detained outside the palace again. The following day Barani tried to run into the palace during the Changing of the Guards ceremony.
Again he was arrested but released due to the limited powers available to deal with him, the court heard.
He was arrested for the killing on June 29 when he "presented himself" to police and soldiers at Horseguards Parade.
Michael McAlinden, defending, told the judge:
"He gave many warning signs that there was something wrong with him."
Scotland Yard said:
"On June 29 a man was seen acting suspiciously by officers in the vicinity of Horseguards Parade. He was arrested and taken to a central London police station.
"Following a match on the DNA database to forensic samples taken at the scene of the murder Barani was charged."