A New York City man was arrested at JFK Airport Wednesday night and accused of trying to fly to the Middle East to join the Islamic State terror group, law enforcement officials announced.

Saddam Mohamed Raishani, also known as Adam Raishani, was charged with one count of attempting to provide material support to a designated foreign terrorist organization, which carries a maximum sentence of 20 years in prison.

Raishani's court appearance with Magistrate Judge James L. Cott at Manhattan federal court lasted five minutes and he is expected to attend a preliminary hearing scheduled for July 6th. He wore a red checked shirt and jeans and waved hello to a man, believed to be his father, sitting in the courtroom seats.

His plans to travel to Syria were thwarted after he unknowingly contacted a person who posed as a fellow ISIS wannabe, investigators said. Instead, that person was a confidential source working at the direction of law enforcement.

"Having already helped another man make that trip to ISIS's heartland, Raishani allegedly acted on his own desire to wage violent jihad, planning to leave his family and life in New York City for the battlefields of the Middle East," Acting Manhattan U.S. Attorney Joon H. Kim said in a statement.

ISIS URGES ATTACKS ON ISLAM'S HOLIEST DAY

Kim praised the efforts of the FBI and the NYPD in halting the suspect's efforts to support ISIS.

"As we have seen many times before, allegedly attempting to join a designated terrorist organization usually has one outcome: arrest," said NYPD Commissioner James P. O'Neill in a statement.

It was unclear who will represent Raishani at an initial appearance in Manhattan federal court.

Fox News' Shira Bush and The Associated Press contributed to this report.