CHICAGO – To the federal government, Sami Samir Hassoun was a determined terrorist with dangerous plans for Chicago — explosive devices, biological attacks and shootings of police. His family and defense team say he was nothing more than a shameless storyteller who did not possess the sophistication to execute his outlandish and violent ideas.

He was arrested in an undercover sting run by FBI agents, charged, convicted, and sentenced Thursday to 23 years in prison for planting what he thought was a bomb near Wrigley Field.

Undercover stings like the one that led to Hassoun’s arrest have long been employed by law enforcement, but over the past five years, their use and the use of informants have become more established tools in terrorism investigations across the country.

Defense attorneys and other critics say the government almost promotes criminal behavior by keeping would-be terrorists engaged, and comes dangerously close to entrapment — when law enforcement authorities coax someone who has not shown a predisposition to commit a crime to follow through.

Prosecutors say the undercover stings are critical to their battle against terrorism plots, especially those that are domestic.

Hanging in the balance, they say, is the possibility that law enforcement will miss the chance to stop an attack like the one at the Boston Marathon, where two brothers allegedly planted explosives near the finish line of the race, killing three people and injuring more than 260.

“You can’t ignore the potential threat. You have to see how serious it is,” said Chicago lawyer Dan Collins, a former federal prosecutor who oversaw one of the city’s most serious terrorism cases. “Whether you are a bragger or the shyest person on the planet, you do have the ability to present a threat.”

In Hassoun’s case, authorities learned of his plans from an informant. Undercover agents told Hassoun, who then was 22, that they were religious radicals and even paid him to carry out the bombing, later providing him with a phony explosive device.

Prosecutors said Hassoun was already committed to his plan when agents got involved.

In two other Chicago-area cases, the FBI also used covert operations to draw out targets. In those cases, the suspects were teenagers.

Abdella Ahmad Tounisi, of Aurora, Ill., was accused of going online at age 18 to join what he thought was a violent militant group with ties to al-Qaida in Syria. In reality, it was an FBI-run website.

Tounisi’s friend Adel Daoud, also 18, came under the scrutiny of the FBI after posting messages online about killing Americans, authorities said. Undercover FBI analysts exchanged messages with him, ultimately arranging to meet.

As with Hassoun, they provided Daoud with a phony explosive device, this one a car he thought was rigged with a bomb, authorities said.

Tounisi and Daoud cut young and sympathetic figures in court that contrasted with the violent plans at the center of the charges against them. Their alleged exchanges with the government on the Internet also hint at their youth and immaturity, with Daoud using phrases like “LOL” and Tounisi allegedly wondering if his small stature would leave him ill-equipped for a fight.

Both defendants have pleaded not guilty.

Daoud’s attorney, Thomas Anthony Durkin, said last week that he is considering an entrapment defense.

“Adel Daoud was a very impressionable young kid, an immature 18-year-old who got involved in a school project on Osama bin Laden and al-Qaida,” he said.

While the cases are unique in many ways, the ages of the people swept up in them is a cause for concern, said Karen Greenberg, director of the Center on National Security at Fordham University.

“The youth of these kids is very troubling,” she said. “We need to begin to understand these young men who begin to show evidence of violence and willingness to break the law earlier in their lives directing that, not in terms of law enforcement, but in other social services.”

The stings are also a concern for Muslim-Americans. Dr. Zaher Sahloul, former chairman of the Council of Islamic Organizations of Greater Chicago, said the stings play on the vulnerabilities of disaffected, immature youths.

“I am very uncomfortable with these tactics,” he said. “It touches on a very raw, open wound in the community.”

FBI spokeswoman Joan Hyde said officials appreciate the desire of Muslim community leaders to intervene with youths who exhibit violent inclinations, and encourage it. But she stressed the need for law enforcement to move quickly when a potential threat emerges.

“The challenge we are facing is that so much of this is going on online,” Hyde said. “And the radicalization is occurring at a relatively fast rate.”

At Hassoun’s sentencing last week, his age and the prospect that he was entrapped by the government were key points of discussion.

Hassoun’s attorneys criticized the undercover agents for “moving the ball forward” in the plot, saying Hassoun would never have accomplished it without them.

Prosecutors devoted much of their argument to rebutting that notion, saying he had formulated concrete terror plans and was determined to see them through to fruition.

He never wavered, the prosecutors said, and he ignored opportunities to back out. They said they were not giving Hassoun ideas but testing his commitment to his own notions.

“How is the FBI supposed to know that Mr. Hassoun might not engage in this kind of chatter with someone else, someone who can really build a bomb?” Assistant U.S. Attorney Tinos Diamantatos said in court.

U.S. District Judge Robert Gettleman, in sentencing Hassoun, acknowledged the tension in these cases. He noted Hassoun’s troubled youth and said the FBI had “led” him during its undercover investigation.

But the judge, who also mentioned the Boston Marathon bombings, took pains to say Hassoun never took advantage of the chances the agents gave him to abandon the plot. He gave the agents credit for thwarting Hassoun’s plans.

“This is the type of law enforcement we should all applaud,” he said.