BUFFALO, N.Y. (AP) — A New York man who traveled to Turkey to join the Islamic State group said Monday he thought it would be the best way to help victimized Syrians and that he never wanted to be a fighter, as prosecutors contended.

Before being sentenced to 15 years in prison for attempting to provide material support to a terrorist organization, Arafat Nagi said his goal was to provide humanitarian aid.

But it was a claim U.S. District Judge Richard Arcara said he had a hard time believing after looking at Nagi's graphic and violent social media posts and a photo showing him wearing camouflage and posing with an assault-style rifle, his face, except for his eyes, covered in black.

"How would you go out and give humanitarian aid wearing this kind of an outfit?" Arcara asked Nagi, a 47-year-old American-born grandfather.

Assistant U.S. Attorney Timothy Lynch said Nagi bought body armor and other tactical gear and reached out to a member of the "Lackawanna Six" — a group of men from his city who went to prison for providing material support to al-Qaida — for advice on what to pack for the Middle East.

He also shared numerous images and videos of people being drowned, burned and beheaded and publicly pledged his loyalty to Islamic State leaders, whom he viewed as the only ones defending Sunni Muslims in the region, prosecutors said. While in Turkey, Nagi was in contact with other Islamic State supporters, Lynch said.

"That's not humanitarian," the prosecutor said.

Nagi's first trip, in 2012, was cut short by illness. He told relatives he never entered Syria as planned during a 2014 trip because he thought Turkish police were following him. Nagi was planning a third trip to Turkey, with plans to continue to Syria, at the time of his arrest in July 2015, authorities said.

"He was going not to save people, judge, but to kill people," Lynch said.

Nagi, bearded and with his graying hair in a short ponytail, was supported in court by several men, women and at least one young child, some of whom left the courtroom in tears while the judge explained why he was imposing the maximum sentence. All declined to speak with reporters.

Nagi, in a letter to the judge, said he had been moved by media reports of atrocities in Syria and video of Syrians pleading for help.

"I let my emotions take over without thinking," he wrote. "I wanted to help the people of Syria in any way I could. The most well organized group in Syria was the Islamic State."

His attorney, Jeremy Schwartz, said his judgment had been clouded by too much medication and that Nagi is "sort of mortified" by the sum of his social media posts.

Philip Frigm, assistant special agent-in-charge of the FBI in Buffalo, said Nagi was seen as a threat to the U.S. after falling short in his efforts to join with terrorists overseas.

"When they're frustrated in those efforts, they may turn around and change those tactics," Frigm said. "We've seen it before, when individuals will then act out within the United States' borders."

More From WIBX 950