A 23-year-old Oakland man was sentenced to more than 15 years in federal prison Tuesday after boasting about plotting a series of Islamic State-inspired attacks around the Bay Area.

Amer Sinan Alhaggagi — described by prosecutors as a grave terrorist threat but by defense lawyers as a harmless “troll” — was sentenced to 188 months in federal prison, followed by 10 years of probation, after pleading guilty in July to attempting to provide material support to a terror organization as well as to fraud charges.

Alhaggagi was recorded telling an undercover FBI agent two years ago that he planned to kill 10,000 people in a series of attacks, which included bombing nightclubs in San Francisco, distributing rat-poison-laced cocaine, bombing UC Berkeley dorms and torching the fire-prone East Bay hills.

The threats first came in online chat rooms before Alhaggagi, a onetime Berkeley High student, met with undercover FBI agents on two occasions. Prosecutors said they found a bomb-making manual on his computer and discovered he had applied to the Oakland Police Department.

In late 2016, Alhaggagi created Twitter, Facebook and Gmail accounts for two people he thought were Islamic State sympathizers. Authorities said at least one of the people turned out to be an Islamic State member.

Alhaggagi’s defense attorneys pleaded for a lenient sentence from Senior U.S. District Judge Charles Breyer, arguing over a two-day hearing that the defendant was nothing more than a “troll” who liked to provoke people online with jokes.

“He’s a goofball. He’s a class clown. He’s a horrible little person when it comes to trolling,” attorney Mary McNamara said. “This is not somebody who behaves like a jihadi.”

Breyer disagreed, saying Alhaggagi showed “lack of empathy for others that is chilling.”

“Part of the danger of this type of activity is that its consequences are horrendous,” the judge said. “If people lack empathy toward one another, they are extremely dangerous if given the tools to commit criminal conduct.”

Alhaggagi’s mother cried outside court, where she was embraced by her younger son and surrounded by dozens of members of the East Bay Yemeni community who packed the court’s gallery for each of the court appearances. Nearly 150 people signed a letter to the judge saying the punishment “will be suffered by the entire community.”

“We have seen Amer grow up, and we know him to have been a very immature young man with a boundary-pushing streak, but also a good-hearted and generous person,” the letter stated.

Assistant U.S. Attorney Waqar Hasib called two jailhouse informants to the witness stand Tuesday to describe Alhaggagi’s conduct at Glenn Dyer Jail in Oakland in early 2017, after he was arrested.

Richard Jump, 54, now serving time for auto theft in Sonoma County, said he contacted the FBI after hearing Alhaggagi discuss weapons, explosives and plans to blow up the federal building in San Francisco.

“This stuff is so far out of what I’ve always considered acceptable criminal behavior,” said Jump. “I know that sounds crazy, but we have our own moral code. It’s indiscriminate, this type of action. It can hurt anyone. Kids and women and innocent civilians, they’re not fair game in the world I’m from.”

On cross-examination, McNamara tried to discredit Jump’s testimony, pointing out inconsistencies in his statements to the FBI and noting his lengthy rap sheet.

According to prosecutors, Alhaggagi detailed his terror plans in chat rooms in 2016.

“The whole Bay Area is going to be up in flames. My ideas are genius. Lmao,” Alhaggagi wrote, using internet slang for “Laughing my ass off.”

Hasib played video of Alhaggagi meeting with an undercover agent posing as an Islamic State sympathizer and bomb expert in Oakland, during which the defendant pointed out locations for terrorist attacks. Alhaggagi said he planned to set fires in Tilden Regional Park and pointed to dorms at the UC Berkeley campus where he would plant backpack bombs.

The two met again, with Alhaggagi bringing three backpacks to a storage locker for later use in a phony attack.

Alhaggagi, though, broke off communications with the undercover agents. He remained under surveillance until he was arrested Nov. 28, 2016, for using a fraudulent credit card. Later, prosecutors brought the terrorism charge.

Evan Sernoffsky is a San Francisco Chronicle staff writer. Email: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky