A Commack man who vowed to wage “violent jihad” twice tried to travel to Syria to join the Islamic State or another terrorist group, authorities said Saturday.

Elvis Redzepagic, 26, told investigators he was “prepared to strap a bomb on and sacrifice himself,” according to a criminal complaint unsealed Saturday.

After an earlier arrest on an unrelated minor charge, Redzepagic told Suffolk police, “I’m going to leave this country and I’m going to come back with an Army — Islam is coming,” the federal complaint states.

Redzepagic, a U.S. citizen who once worked as a Manhattan doorman, is charged with attempting to provide material support to the Islamic State, also known as ISIS, and the al-Qaida affiliate known as Jabhat al-Nusra.

A judge in Brooklyn federal court Saturday ordered Redzepagic, who did not enter a plea, held without bail. A bail hearing was set for Monday in U.S. District Court in Central Islip.

Investigators from the FBI’s Joint Terrorism Task Force interviewed Redzepagic on Feb. 2 and 3, after Suffolk police arrested him for marijuana possession.

advertisement | advertise on newsday

Redzepagic told task force investigators that in 2015 he tried to travel to Syria to join his cousin, who Redzepagic said is a follower of ISIS leader Abu Bakr al-Baghdadi and a battalion commander, according to the complaint.

Redzepagic was unable to cross into Syria from Turkey, so in 2016, he tried again, this time through Jordan, but the Jordanians deported him. Investigators said they found numerous messages sent from Redzepagic’s Facebook account that include references to him wishing to fight for God and trying to enter Syria.

One message states: “Since i got back from turkey from trying to perform Jihad and join Jabhat Al Nusra the cia has been bothering me. … Its annoying but i out smarted them.”

Redzepagic told investigators he didn’t want to harm “innocent” people but didn’t explain who he considered innocent.

“This defendant made numerous attempts to travel to Syria to wage violent jihad,” Robert L. Capers, U.S. attorney for the Eastern District of New York, said in a statement. “We will continue to track down and prosecute individuals like the defendant before they are able to become foreign fighters or harm the United States and its allies.”

Redzepagic’s lawyer, Mildred Whalen, said in a statement that her client “is an American citizen who has been fully cooperative with the government’s investigation. We hope to work with Mr. Redzepagic’s family to show the Court and the government that Mr. Redzepagic needs treatment and care, not imprisonment.”

Sources familiar with the case said Redzepagic has a serious drug problem. Family members couldn’t be reached for comment.

Derek LaBarbera, 25, of Commack, said he and Redzepagic used heroin and cocaine together starting when they attended Hauppauge High School. LaBarbera said he’s been clean for a year, but as recently as Jan. 30, Redzepagic texted him about meeting a drug dealer.

advertisement | advertise on newsday

LaBarbera said Redzepagic wasn’t “really that bad of a kid,” but he repeatedly got into fights in high school.

As LaBarbera talked near Redzepagic’s parents’ house on a quiet tree-lined street in Commack, he said he stopped regularly hanging out with Redzepagic about two years ago, because “he was always talking about the Quran and I didn’t want to hear that.”

LaBarbera said Redzepagic told him what at the time he thought was an “unbelievable story” about authorities tracking him while he was using a computer last summer in “his country.” Sources said Redzepagic’s parents are from the Balkan nation of Montenegro.

“He literally has said to me, ‘You know, I’m a terrorist,’” LaBarbera said. “I just thought it was like a big joke.”

Redzepagic worked as a doorman in Manhattan but was fired, according to a source.

advertisement | advertise on newsday

In addition to the marijuana arrest, Redzepagic pleaded guilty in 2012 to misdemeanor theft charges while living in Brooklyn, records show.

Suffolk Police Commissioner Timothy Sini said two Suffolk detectives on the terrorism task force were heavily involved in the investigation, as were several other department members.

“This is a great arrest and exactly why local law enforcement should be collaborating,” Sini said.

Nassau County and Port Authority police assisted in the investigation.

Theresa Canty, 46, who lives in Redzepagic’s Commack neighborhood, said it’s hard to believe that she drove past an accused terrorist’s home almost every day.

“It’s scary to think I live so close to him,” she said.

With Matthew Chayes and Mark Morales