Updated

A New York City man faced terrorism charges Tuesday accusing him of trying to support the Islamic State group by travelling to the Middle East to fight with militants.

An unnamed country in the region detained Parveg Ahmed before he could carry out plans to enter territory in Syria controlled by the Islamic State, according to a criminal complaint that didn't name the country.

The 22-year-old Queens resident was returned Monday night to New York, where he was ordered held without bail on Tuesday in federal court in Brooklyn. His lawyer, Michael Schneider, declined to comment.

"As alleged, Ahmed sought to take up arms with violent terrorists who have killed numerous innocent victims, including Americans," Acting U.S. Attorney Bridget Rohde said in a statement.

According to the complaint, Ahmed first began posting pro-Islamic State messages on social media in 2014 and 2015. One read, "The side of Good is Islam & the Caliphate. If you're not with the Muslims, you're ignorantly, irrelevantly, & arrogantly on the side of Evil," the complaint said.

In June, Ahmed and a person referred to only as a confidential co-conspirator traveled to Saudi Arabia before they were captured, the court papers said. A cellphone carried by Ahmed contained an unsent message saying, "God willing, we will join the Jijad very soon" and a farewell to his family reading, "Please remember all that I tried to teach you."

Agents searching a laptop used by Ahmed also discovered Islamic State propaganda and sermons by fiery American-born cleric Anwar al-Awlaki, a leader of al-Qaida in Yemen who was killed in 2011, the papers said. The online videos of Al-Awlaki have been cited in several U.S. cases as being a dangerous influence on self-radicalized terrorists.

The computer contained other lectures by Sheikh Abdullah el-Faisal, a radical cleric arrested last week in Jamaica on a U.S. warrant accusing him of trying to recruit radicalized Americans for the Islamic State group. El-Faisal had been the target of a sting carried out by an undercover New York Police Department officer who communicated with him by email, text and video chat.

If convicted, Ahmed faces a maximum 20 years in prison.