NEW YORK (Reuters) - A Yemen-born New York City resident on Friday pleaded guilty to attempting to provide support to Islamic State, admitting that he tried to join the organization and urged someone else to join too.

Mohamed Rafik Naji entered his plea to one count of attempting to provide material support to a foreign terrorist organization at a hearing before U.S. District Judge Frederic Block in Brooklyn. He faces a maximum sentence of 20 years in prison.

“I traveled to Yemen in 2015 to join ISIS and I encouraged another person to join,” Naji said at the hearing, using a common acronym for Islamic State. He said he did not actually join the organization.

Naji said at the hearing that he was born in Yemen, and that he was 38 or 39 years old. Block noted that Naji was a legal permanent resident of the United States, and faced deportation as a result of his guilty plea.

Naji was arrested in New York in November 2016.

According to a criminal complaint filed around the time of the arrest, Naji flew to Turkey to join Islamic State in Yemen in March 2015, and returned to New York in September 2015, flying from Djibouti.

The complaint said that while abroad, Naji frequently emailed his girlfriend, asking her for money and sending her a photograph of himself in black clothing in which a tactical vest and large knife could be seen.

In August 2015, a paid law enforcement informant began communicating with Naji through Facebook, according to the complaint. After Naji returned to the United States, he had multiple meetings with the informant in which their conversations were recorded, the complaint said.

One conversation occurred on July 19, 2016, five days after an attack in Nice, France that killed 84 people and hurt hundreds more, for which Islamic State claimed responsibility, the complaint said.

In that conversation, Naji expressed his support for staging a similar attack in New York’s Times Square, according to court papers.