A California man with delusions of joining the Taliban has been jailed for 15 years for trying to blow up a bank.
But the "car bomb" he thought would go off was actually made up of inert materials supplied by the FBI in a sting, the court in Oakland was told.
US District Judge Virginia Rogers said she was satisfied that the sentence - spelled out in a plea deal between Matthew Llaneza and federal prosecutors - struck a balance between acknowledging the 29-year-old from San Jose's mental condition and punishing him.
Llaneza was arrested last February near a Bank of America building in Oakland after he tried to detonate an SUV loaded with chemicals he secured with the help of an FBI agent posing as a Taliban go-between.
Both the vehicle and the inert chemicals loaded inside were supplied by FBI agents after Llaneza allegedly made contact with an undercover agent who pretended to have connections with the Taliban and helped him build a fake car bomb.
He was arrested near the four-storey bank building in Oakland after he pressed a mobile phone trigger to try to detonate the explosives, which he believed were real.
The FBI said Llaneza hoped the explosion would be blamed on anti-government militias and prompt a government crackdown that would start civil unrest across the United States. He also allegedly bragged that he had experience in guerrilla warfare and expressed a desire to join the Taliban in Afghanistan after carrying out the terrorist plot.
Along with the prison term, the judge ordered Llaneza to spend the rest of his life on probation, which means he can be searched at any time.
Llaneza, who pleaded guilty in October to attempting to use a weapon of mass destruction - a conviction that would ordinarily carry a sentence of 30 years to life - apologised to the judge and said he would seek psychiatric help in prison.
In a pre-sentencing memo t he US Attorney's Office said it took into account Llaneza's history of mental illness and the fact that he tried to minimise casualties by trying to blow up the building in the early morning.
Llaneza had been diagnosed at various times as suffering from schizophrenia, bipolar disorder and post-traumatic stress disorder.
His defence lawyer, assistant federal public defender Jerome Matthews, said in a memo of his own that he would not argue with a 15-year sentence even though "it is an open question whether Matthew Llaneza would have participated in a plot to detonate a car bomb had he not been introduced to and guided by an undercover FBI agent".
"Matthew was not a radicalised jihadist but rather a delusional, severely mentally disturbed young man; he had no technical skills to speak of," Mr Matthews wrote.
"He had no training or background that would have helped him to accomplish an actual bombing; he was preternaturally suggestible and desirous of being accepted; and, not least, he had no desire to inflict mass casualties."
Llaneza's parents, Steven Llaneza and Dora Tune submitted a letter to the judge, telling of "his genuinely good core character" and lifetime of struggles.
"The conduct he pleaded guilty to is very out of character for him and we never ever would have thought he would come up with an idea like he has been accused of," they said.