A man who said God told him to try to kill a South African tourist by hitting him over the head has been jailed for public protection.
Paul Knipe, 44, of Tadcaster, struck holidaymaker Lyle Thole as he was returning to his hotel in York.
He told 78-year-old Mr Thole he was mentally ill and was going to kill him during the attack in 2011.
Knipe will serve a minimum of four-and-a-half years before being considered for parole, York Crown Court heard.
He had earlier pleaded guilty to attempted murder.
Judge Stephen Ashurst, the Recorder of York, said Knipe had attacked a "completely blameless stranger".
He said: "You picked up a cobble stone and struck him repeatedly around his head. He was in a terrible state and had shed a significant amount of blood."
Mr Thole was said to have been left traumatised by the attack.
He was returning to his hotel in July 2011 when he took a wrong turning near York Minster and found himself at a dead end.
As he turned around, Knipe, who had been following him for around 15 to 20 minutes, struck him on the back of the head with a cobble.
He continued the attack, striking him a further three or four times, while Mr Thole was on his hands and knees.
When he asked Knipe what he wanted, the defendant replied: "I'm mentally ill and I'm going to kill you."
Knipe, in a prepared statement to police, said: "I have been hearing voices for around a year, telling me to kill people.
"I have told my psychiatrist on a number of occasions about these voices but they've told me as long as I don't act on them, everything will be ok."