Three Brooklyn men were arrested Wednesday for allegedly plotting to help the Islamic State after voicing their desire to commits acts of terrorism, according to the FBI.

Two of the men were trying to fly to Turkey “in a vain attempt to evade detection,” FBI Assistant Director in Charge Diego Rodriguez said in a statement. 

The three men, 24-year-old Abdurasul Hasanovich Juraboev from Uzbekistan, 19-year-old Kazakhstan Akhror Saidakhmetov from Kazakhstan, and 30-year-old Abror Habibov from Uzbekistan, were charged with conspiracy to provide material support to the Islamic State of Iraq and the Levant (ISIL), a foreign terrorist organization, according to the criminal complaint unsealed Wednesday.

Juraboev and Saidakhmetov are both permanent residents of the U.S. Habibov had been in the country legally, but overstayed, authorities said.

Law enforcement officers first noticed Juraboev in August 2014 when he allegedly posted on an Uzbek-language website that propagates Islamic State ideology, according to the complaint. He is then accused of admitting that he wished to travel to Syria and wanted to kill President Barack Obama if he had the opportunity.

Through later interviews, Juraboev allegedly admitted to federal agents that if ISIS ordered him to kill the president, or “plant a bomb on Coney Island” he would, according to the complaint.

Saidakhmetov was arrested at Kennedy Airport Wednesday where he was attempting to board a flight to Istanbul. Juraboev, who had previously purchased a ticket for next month to Istanbul, was arrested at a residence in Brooklyn.

Habibov, who was arrested at about 6:30 a.m. in Jacksonville, Florida, was arraigned in the U.S. District Court for the Middle District of Florida. He is accused of helping bankroll the travel plans.

All three were detained following their arraignments Wednesday, authorities said.

Saidakhmetov’s attorney, Adam Perlmutter, said his client never finished high school and had been in the U.S. for a few years.

“When there are allegations of this sort there's no attempt by the government to intervene, there's no attempt by the government to understand, there's just a rush by the government to prosecute, to charge, and to employ the most severe aspects of our criminal justice system to deal with them,” said Perlmutter, speaking to reporters outside of Brooklyn federal court. “If the allegations are as stated, I think that the U.S. government needs to figure out another way to approach Muslim men who may find some attraction to radicalism.”

Attempts to reach an attorney for Juraboev were unsuccessful.

NYPD Commissioner Bill Bratton said the pair were clear in their desire to hurt people.

“This is real,” Bratton said during a news conference at police headquarters Wednesday. “This is the concern about the lone wolf inspired to act without ever going to the Mideast. Or the concern of once they get to the Mideast [acquiring] fighting skills, capabilities and then attempting to return to the country.”

Bratton said the cases of people trying to leave the U.S. and travel to join ISIS “nowhere near approach the scale of what our colleagues in Britain and our colleagues in Europe are dealing with.”

When federal agents interviewed Juraboev he said Saidakhmetov, a friend and co-worker, also shared his views of ISIS, according to the FBI.

“What I’m saying is, to shoot Obama and then get shot ourselves, will it do?” Juraboev allegedly wrote on the site. “That will strike fear in the hearts of infidels.”

Saidakhmetov allegedly posted on the same website, Hilofatnews.com, applauding a video showing mass executions during ISIS’ takeover of Mosul, Iraq, according to the criminal complaint.

Intercepted communications, as well as recorded conversations with a confidential informant, show Juraboev and Saidakhmetov allegedly talked about how best to cross the Turkish border, and purchase weapons, for several months. The confidential informant originally approached Juraboev at a mosque, “posing as an ideologically sympathetic individual.”

“I will just go and buy a machine gun, AK-47, go out and shoot all police,” Saidakhmetov allegedly said during a recorded conversation in January. “We will go and purchase one handgun... then go shoot one police officer. Boom... Then we will take his gun, bullets and a bulletproof vest... then, we will do the same with a couple of others. Then we will go to the FBI headquarters, kill the FBI people...”

In September, 2014, Saidakhmetov allegedly said he would get his passport from his mother by telling her he was going to visit relatives in Uzbekistan, but actually travel to Syria, according to the complaint.

Habibov, who sells kitchenware and repairs cellphones in mall kiosks, hired Saidakhmetov for locations in Savanna, Georgia, Philadelphia, and Chesapeake, Virginia, according to the complaint.

Frank Cakir, an assistant manager at Nil Travel, said he on Feb. 19 he booked a round-trip ticket to Istanbul from JFK for Saidakhmetov. He said Saidakhmetov was among about 100 customers he waited on that day and recalled him as “totally normal” and spoke English “fluently."

“He wanted the cheapest one,” Cakir said. “I gave him other options ...He just told me that -- 'Just make it cheap.'”

He paid $571 with a credit card for round trip travel in coach on Ukraine International Airlines, according to the travel agency's records, which he provided to several news organizations.

His flight was scheduled to leave JFK at 12:30 a.m. New York time, with a layover in Kiev, Ukraine. He never mentioned Syria, said Cakir, 25 years old.

Bahri Caliskan, owner of the travel agency, said Saidakhmetov appeared a “regular American teenager.” Caliskan said he's owned the agency for about 8 years and doesn't have working surveillance cameras in his business.

ISIS, which has overrun territory across several Middle Eastern countries and claimed responsibility for many acts of terrorism, including the beheading of journalist James Foley, is inspiring attacks throughout the west.

“The flow of foreign fighters to Syria represents an evolving threat to our country and to our allies,” said United States Attorney Loretta Lynch in a statement. “We will vigorously prosecute those who attempt to travel to Syria to wage violent jihad on behalf of ISIL and those who support them. Anyone who threatens our citizens and our allies, here or abroad, will face the full force of American justice.”

Sen. Charles Schumer said it is “reassuring” to know law enforcement officers are on top of potential terrorists.

“This foiled ISIS plot sends shivers down the spine of New Yorkers and clearly underscores that we must remain ever-vigilant in the face of terror threats,” Schumer said in a statement, “and that funding our national security must be a top priority of the federal government, at all times.”

With Nicole Fuller, Dan Rivoli and Ivan Pereira