When Soufian Amri found out his friend Haris Qamar had bought a plane ticket to join the Islamic State, he set out to stop him. When Qamar expressed support for the terrorist group, Amri told his friend he was an idiot. Amri even promised to help ­Qamar get a degree and a job where he could do some good.

But when the FBI came to Amri's Fairfax, Va., gaming center and asked whether he knew anyone who had expressed support for the Islamic State or tried to join the group, Amri decided he could not expose a close friend. He lied, saying he knew only of a "tall, thin Indian kid" he had briefly met a long time ago. ­(Qamar is heavyset and of Pakistani heritage.)

Amri asked his business partner, Michael Queen, to lie as well. Now they are both convicted felons, sentenced this month to two years in prison.

"These are serious times," Judge Leonie M. Brinkema said during Amri's sentencing last Friday. "And people have to be cooperative."

But John Zwerling, an attorney for Amri, argued that Brinkema's sentence would only make Muslims more fearful of cooperating.

"The message this case sends is clear," he said after the court hearing. "If you're a young Muslim, if you thwarted your friend from joining ISIS and the FBI comes to talk to you, tell them you have nothing to say."

For the past two years, Amri and Queen have together run the Cave, a storefront in Fairfax where people gather to play video games. Qamar was a frequent customer and sometimes helped out with the business.

Both Amri, 31, and Queen, 28, said that they had no idea Qamar had been attempting to actively help the Islamic State through a confidential informant they knew as Ali. At Ali's instigation, Qamar bought gift cards he thought would be used by terrorists to send messages and took photos of Washington-area landmarks he believed were for a propaganda video. He was sentenced this year to 8½ years in prison.

Prosecutors stressed that Qamar said shocking things, including that he would like to chop off heads and drink "a blood slurpee" for the Islamic State. Had he been involved in a true terrorist plot, prosecutors said, his friends would have stood by while people died. They let Qamar use the Internet at their business, even after he was banned by Twitter for celebrating mass murder.

"In this case, Queen and Amri not only discounted Qamar's gruesome Twitter activity, his love of violent ISIS videos, and his attempt to travel to join ISIS, but also openly lied about it to the FBI," prosecutors Colleen Garcia and Gordon Kromberg wrote in a court filing. ISIS is another name for the Islamic State.

In follow-up interviews, when it became clear Qamar was the focus of an investigation, Amri and Queen came clean. Amri said that he never thought Qamar would act on his violent words, even if he had made it to the Middle East.

"[It's] hard when you know someone and you can feel it in your heart that that person is really a good person and that he has just kind of warped viewpoints on a lot of things," Amri told an agent, according to court filings. "I love the guy."

Despite his supposed commitment to a Sunni group that has targeted Shiite Muslims, Qamar treated the game store's "Iraqi Shiite customers . . . so well and so nice," Amri told the FBI agent. "It breaks my heart."

In court, Amri apologized. "I didn't have the right to make that decision," he said.

Amri early on had cheered the Islamic State, thinking it was defending Sunni Muslims against the Syrian regime of Bashar al-Assad. His Google Play profile photo was an Islamic State flag. But friend Antoine Bridges wrote in a letter to the court that Amri changed his mind when he learned of the atrocities being committed, in particular the beheading of photojournalist James Foley in August 2014. He would tell Qamar he was an American, that he "needed a reality check," Bridges said.

Amri told the FBI he thought of Qamar as a "brother" and felt obligated to try to steer him in the right direction. When Qamar bought a plane ticket to Turkey in 2014, Amri said he told him to go to his parents and apologize; they took his passport away. He encouraged Qamar to focus on school and a career in civil engineering, saying he was planning to start a granite business and would give his friend a job.

Kayla Merlino wrote to the court that she was suspicious of Islam when she started dating Amri last year and engaged him in deep conversations about politics and religion. She said that Amri warned her about Qamar but said he thought his friend would soon outgrow his "really polarizing political viewpoints we can't stand."

Merlino now also works at the Cave. She said the business is likely to close while Amri and Queen are in prison, although other co-owners hope to keep it open.

Other friends and family emphasized Amri's kindness.

"He is the person I would call if my car broke down in the middle of the night and I needed a lift. He is the person who would run to pick up my daughter from school if I was running late or stuck in traffic," his brother-in-law wrote. "He is dependable and his support is unlimited and unconditional."

Amri would let homeless people sleep in his game store or help out in exchange for food and computer use, Bridges wrote.

He is "generous," Amri's mother wrote — "sometimes to a fault."