Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

SAN FRANCISCO — A federal judge on Tuesday sentenced a 23-year-old Northern California man to more than 15 years in prison after he pleaded guilty to trying to support an Islamic terrorist group.

Amer Alhaggagi pleaded guilty in July to creating Twitter, Facebook and Gmail accounts for people he thought to be ISIS supporters he met in online chat rooms. He was also secretly recorded plotting for two years with undercover agents to blow up courthouses, landmarks and tourists attractions throughout the San Francisco Bay Area.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Alhaggagi and his attorneys argued for a much lighter sentence and tried to portray the Berkeley High School graduate as an out-of-work, pot-smoking internet "troll" seeking only to provoke and annoy with violent, anti-American claims. His attorney Mary McNamara called the oldest son of Yemeni-born parents a "class clown." Federal probation officials recommended a four-year prison sentence.

Some 150 residents of Oakland's tight-knit Yemeni community signed a letter given to Breyer on Monday urging leniency. The letter said the community was creating an educational program to teach children about online behavior and speech and how to properly respond to online strangers advocating terrorism.

Before he was sentenced, Alhaggagi apologized after a daylong hearing where recordings of his violent anti-American boasts were played and displays of text messages threatening to kill his Oakland neighbors.

"I find it hard to look and listen to all the horrible things I said to the undercover agent," he said. "I made myself look like a crazy person."

But U.S. District Judge Charles Breyer rejected the portrayal of Alhaggagi as a naive blowhard who never intended to follow through with his threats.

"Words matter," the judge said. "The most disturbing thing in Alhaggagi is the lack of empathy for others. That is chilling."