ALEXANDRIA, Va. — More than 100 people in the U.S. have been charged with trying to help the Islamic State, or trying to join it, but Mohamad Khweis stood out because he succeeded.

Khweis, 27, the only American citizen to be convicted in a U.S. jury trial of successfully joining the Islamic State overseas, was sentenced to 20 years in prison Friday.

Khweis, from Alexandria, Virginia, was convicted on terrorism charges earlier this year. Khweis traveled to Islamic State-controlled territory in Iraq and Syria in December 2015, even obtaining an official membership card. But he found life there distasteful and escaped after a few months. He surrendered in northern Iraq to Kurdish forces, who broadcast his capture around the world.

The vast majority of people charged in U.S. courts with Islamic State-related terrorism offenses ran afoul of sting operations in which the suspects thought they had made a connection with the terrorist group, only to find out that their supposed contacts were actually undercover informants or agents.

The unique nature of Khweis’ crime merited a strong sentence, said prosecutor Dennis Fitzpatrick, who argued for 35 years in prison.

“This defendant executed his plan to perfection. He got into the Islamic State. He was in their machinery. He was providing himself and his services to the organization,” Fitzpatrick said.

Once he made it to the Islamic State territory in late 2015, he “became the consummate utility player for the Islamic State,” said prosecutor Raj Parekh. “When ISIS needed his blood, he allowed them to draw it. When ISIS needed him to cook and clean for wounded soldiers, Mohamad Khweis multitasked and filled that role as well.”

One thing Khweis never did, his lawyers said, was take up arms on behalf of the Islamic State.

“While he was there, he did not fight. He did not do harm to another human being,” defense attorney John Zwerling said.

Zwerling agreed with the suggestion from prosecutors that Khweis’ case is unique because he is one of the few Americans to actually make it to Islamic State territory. But he said his client deserves a measure of credit for leaving the Islamic State on his own, and cooperating with authorities by providing them intelligence on the group’s inner workings. He also helped authorities identify four Westerners who had left the Islamic State with intentions to do harm in their home countries.

“He provided valuable, actionable intelligence,” Zwerling said. “And the government has given him zero credit for any of it.”

Zwerling argued it was counterproductive to punish Khweis with decades in prison, because it sends the message to other Americans who might consider abandoning the Islamic State that they have nothing to look forward to in the U.S. but a prison cell. Zwerling and defense attorney Jessica Carmichael argued for a five-year sentence.

Khweis did not speak at Friday’s sentencing hearing in U.S. District Court in Alexandria. In a letter to the court, he apologized for his actions and said, “When I arrived in Syria reality hit me. I couldn’t believe what I had done and where I was at. I hated myself for making the worst decision I ever made in my life.”

Despite a trial in which Khweis took the stand in his own defense, his motivations for joining the Islamic State remain a mystery. He testified that he was curious about what life was like in the Islamic State’s self-proclaimed caliphate, but even his own attorneys acknowledged that Khweis’ testimony was riddled with lies.

“The record is void of what motivated him, what got him to go,” Zwerling said.

Khweis grew up in a middle-class neighborhood in Fairfax County, just outside the nation’s capital, graduating in 2007 from Edison High School. Before leaving for the Middle east in 2015, he worked as a bus driver for the elderly and disabled in the region’s Metro system. His parents emigrated from the Middle East and he grew up as a Muslim, but was not particularly religious. His parents, who attended Friday’s hearing, declined to comment.

“There is no event, no instigator, no friend … no suicidal ideation that radicalized you,” Judge Liam O’Grady said before imposing his sentence, “but there is no question you did radicalize.