A college dropout and Muslim convert who threatened the creators of the "South Park" cartoon series and then tried to join an al-Qaida-linked terror group in Somalia was sentenced Thursday to 25 years in prison.

Zachary A. Chesser, 21, of Bristow, Va., pleaded guilty last year to supporting the al-Shabab terrorist group in Somalia and posting online threats against the "South Park" creators for an episode that he perceived as insulting to the prophet Muhammad.

The 25-year sentence was halfway between the 20-year term sought by the defense and the 30-year maximum sentence sought by prosecutors.

Chesser achieved notoriety on the Internet under the name Abu Talhah Al-Amrikee when he warned the creators of "South Park" that they risked death for mocking Islam. His online propaganda included urgings to leave suspicious packages in public to desensitize authorities to a real bomb threat and instructions on raising children who would grow up to be al-Qaida members.

Later, he tried twice to travel to Somalia to join al-Shabab. The first time, he planned to travel with his wife but was thwarted when his mother-in-law hid his wife's passport. The second time, he took his infant son to the airport with him as cover, thinking that a person traveling with a baby would look less suspicious. But by that time, Chesser was on the no-fly list.

Chesser apologized in court for his conduct and in a written statement to the court said he is "ashamed and bewildered. ... I know that I will spend many years trying to understand why I followed the path that has led me here."

Assistant U.S. Attorney Gordon Kromberg said that even if Chesser is truly sorry for his actions, it cannot undo the damage. He said those who were threatened, like the "South Park" creators, will continually have to worry if someone might act on Chesser's exhortations. Kromberg also said Chesser struck a chord in the international jihadist community — each of the last four issues of the al-Qaida-affiliated Inspire magazine have included calls for Chesser's release.

Fundamentally, Kromberg said, Chesser's threats make people unwilling to debate an important topic.

"The natural consequence of his actions is that people fear speaking out, even in jest, lest they be labeled as enemies of Islam," Kromberg said.

Chesser's lawyer portrayed his client as a drifting teenager who latched on to activities and philosophies with a freakish intensity. Before Chesser converted to Islam, he participated in high school sports and later joined a Korean breakdancing team at his school. He spent years as a vegetarian and dabbled in Buddhism. He became so fascinated with Japanese anime that he spent four years studying Japanese and traveled to Japan on a school trip.

And, when he became infatuated during his senior year with a Muslim girl, he converted to Islam. He quickly drifted toward a radical, fundamentalist interpretation of the religion.

In a letter to the court, Chesser's father, David Chesser, described the rapid changes he saw in his son's behavior in the fall of 2008, when his son was briefly enrolled at George Mason University.

"Zac started to change his appearance in accordance with what he thought a devout Muslim should do: growing a beard; wearing robes, cutting off the bottoms of his pant legs ... and even wearing some type of loin cloth in place of underwear," the elder Chesser wrote.

U.S. District Judge Liam O'Grady, as he imposed the sentence, told Chesser: "You took just a shocking leap from a high-school athlete to a highly energized traitor to your country. It's startling."

(This version CORRECTS day of the week in first paragraph, Thursday instead of Friday.)