Wang Ching-yu, 34, had pleaded guilty to killing the child in a crime that shocked the generally peaceful island after overpowering her mother near a metro station.
He beheaded the girl with a kitchen knife as horrified bystanders tried to stop him.
Wang had told the court that he hallucinated he was a Chinese emperor from Sichuan province and believed that killing the girl would bring him concubines to "carry on his family line," according to reports.
Prosecutors called the crime "extremely cold-blooded" and demanded the death penalty.
Also Read
But judge Tsai Shou-hsun told a Taipei district court Friday that he would instead be jailed for life as he had a "mental handicap".
Wearing black-framed glasses, a white T-shirt and track pants, his head shaved, Wang remained calm as he listened to the verdict, responding: "I understand".
The victim's family were not in court.
It said Wang had been expelled from school and had gone through drug rehabilitation, but was reclusive and isolated, developing schizophrenia and hallucinations.
However, the statement also described the killing as "grotesquely violent", adding that Wang had known murder was illegal and had dodged supervision in order to commit it.
"He has not shown empathy and regret, and after assessment the chance of committing crime again is still high," the statement said.
Taiwan resumed capital punishment in 2010 after a five- year hiatus. Executions are reserved for serious crimes such as aggravated murder.
After the decapitation in March last year, hundreds of Taiwanese, many dressed in black and wearing stickers reading "Death penalty is necessary," called for Wang to be executed.
The killing came less than a year after the throat of an eight-year-old girl was slit in her school restroom in Taipei. It sparked widespread public anger and fresh debate about capital punishment.
Disclaimer: No Business Standard Journalist was involved in creation of this content