The plot began as a sinister bid for revenge, prosecutors said, a failed murder attempt by a spurned lover worthy of a made-for-TV movie.

But in the months since Nicholas Helman placed a ricin-laced birthday card in the mailbox of his ex-girlfriend's new beau, the effects of his downward spiral mushroomed, sweeping up people including his own family and friends.

That was apparent Monday as dozens packed a Doylestown courtroom and watched Helman, 20, receive a prison sentence of 20 to 40 years for a laundry list of crimes, including attempted murder and risking a catastrophe.

The grief peaked just before Helman was taken out of the courtroom, when his family was allowed to hug him one last time.

"I'm so sorry," his mother sobbed into his shoulder as Helman, donning an oversize gray suit, dipped his head and cried.

Judge Alan Rubenstein had little sympathy for the former Eagle scout, comparing his plot - which involved concocting the poison ricin from castor beans he ordered online - to those of would-be terrorists who read instructions from al-Qaeda on the Internet.

"You are bright. You are articulate. You are responsive," Rubenstein said. "But I don't think you appreciate the damage you have caused to people very close to you."

Helman previously pleaded guilty to lacing a scratch-and-sniff birthday card with a lethal dose of homemade ricin in March 2014. At one point, he considered using a cigarette.

After sealing the envelope, Helman walked several miles from Hatboro to the family home of Jake Palm in Warminster and placed the card in the mailbox.

Helman subsequently bragged about his plot to a coworker at the Warrington Target store. That colleague alerted police, and authorities were able to stop the family from opening the card. After tests confirmed it contained the deadly toxin, Helman was arrested by an armada of heavily armed police at the apartment he shared with his mother.

Eight months later, Helman was charged with asking a fellow inmate to kill the detective investigating the case and rip out the tongue of a prosecutor handling it. He also threatened to harm witnesses and coworkers, he admitted in court Monday.

Helman told Rubenstein that he was "extremely sorry" for his actions and that being dumped by his girlfriend set off a terrible mental downfall for him.

"I wish I could turn back the clock," he said, battling tears. "I don't know how or why my mind came to this awful decision."

Robert James, the county's chief of trials, said Helman had shown no remorse since he was arrested, and compared him at one point to James Holmes, who killed 12 people in a Colorado movie theater in 2012.

Helman "lies constantly to whoever's listening," James said. "And he doesn't take any of this seriously."

Rubenstein called Helman's crimes "almost incomprehensible" and said that he was heartbroken for everyone involved.

"You're a 20-year-old man who has basically ruined your life because of a foolish plot," he said.

Beyond Helman's family, the gallery on Monday included his former coworkers, his former Scout leader, and the Palm family.

None commented after the verdict, though Jake Palm did speak in court.

"He has terrorized our lives," Palm said. "We will always have fear for our family when he is released."

Rubenstein said he would make a recommendation that Helman be sent to a Luzerne County facility that has a strong mental health program to provide him treatment.

Still, he said, Helman's actions were likely to impact his family and victims for years to come.

"Your anger festered," he said. "It could have been an absolute nightmare for so many people."