For the first time, Ali Amin felt respected, even revered. The Northern Virginia teenager who admitted to running a ­pro-Islamic State Twitter account and helping a friend join the terrorist group in Syria had found on the Internet a venue to trade views about his faith and promote a better society for Muslims.

But by his own telling, the 17-year-old’s thinking had become “distorted.”

Convicted of conspiring to provide material support to terrorists, Amin wrote in a letter to the judge who will sentence him that he had traded the real world for a virtual one and poured himself into a cause that “takes the greatest and most profound teachings of Islam and turns them into justifications for violence and death.”

Late Friday night through his lawyer, Amin asked the judge to sentence him to six years and three months in prison — a term less than half the 15-year punishment prosecutors are seeking. He wrote in a letter that he had cooperated with authorities and realizes that he had been wrong.

“I am deeply ashamed for becoming so lost and adrift from what I know in my heart is right,” Amin wrote.

Ali Amin (NA/Courtesy of Joe Flood)

Amin, a former student at Prince William County’s Osbourn Park High School, whose family used to live in Woodbridge, pleaded guilty in June, admitting that he ran the controversial @AmreekiWitness Twitter account and that he helped a friend, 18-year-old Reza Niknejad, join the Islamic State in Syria.

Prosecutors have urged the maximum possible penalty. Amin’s message, they said, reached “untold numbers of people worldwide” and radicalized and ruined the life of Niknejad, who they said was likely to die fighting overseas.

Niknejad, also a former Osbourn Park student, was charged with conspiring to kill or injure people abroad and conspiring to provide material support to terrorists and the Islamic State. He is believed to still be abroad.

Born in Sudan, Amin came to the United States as a youth with his mother, Amani Ibrahim, and became a naturalized citizen. Ibrahim wrote in her own letter to the judge that she was a protective mother, especially after her son was diagnosed with Crohn’s disease around age 10.

Amin excelled in school, but health problems forced him to withdraw from a rigorous academic program, and he soon began spending more time on the Internet, Ibrahim wrote. She wrote that she and her husband eventually checked Amin’s phone and computer and made the “shocking” discovery that he “was talking to people who seem much older than him” about the Islamic State and jihad.

Ibrahim wrote that she connected her son with Imam Mohamed Magid at the All Dulles Area Muslim Society, and he went to a camp and seemed to make new friends. But he started to become more active online again, and Magid advised her to contact the authorities, Ibrahim wrote.

Ibrahim wrote that while she was glad that Amin did not travel to Syria, she felt “very confused and conflicted about having played a role” in his arrest. The Islamic State’s online recruiters, she wrote, stole the dreams she once had for her son, but she felt the youth was “very ready now to study the true Islam as he is back to the right path.”