For a second time in three months, a federal judge in Central Islip on Monday denied bail for a Commack man who authorities said twice traveled to the Middle East in an effort to “wage violent jihad” alongside a terrorist group.

U.S. Magistrate A. Kathleen Tomlinson ordered Elvis Redzepagic, 26, held without bail while he answers charges he attempted to provide material support to one or more foreign terrorist organizations — the Islamic State of Iraq, or ISIS, and an al-Qaida affiliate named Jabhat al-Nusra.

Redzepagic, the judge said, had done more than express hatred toward the United States on his Facebook account. He bought plane tickets and traveled overseas and made “multiple attempts” to cross into Syria, she said.

“The evidence here is strong,” Tomlinson said.

Redzepagic had pleaded not guilty to two counts of attempting to provide material support to one or more foreign terrorist groups. If convicted, he faces up to 20 years in prison.

Redzepagic was arrested on Mar. 4. On March 6, U.S. Magistrate Anne Shields issued a permanent order of detention for him. On Monday, his public defender, LaKeytria Felder, asked Tomlinson to reconsider Shields’ order.

advertisement | advertise on newsday

Felder told the judge that her client had lost his way a after yearslong struggle with drug addiction and mental illness.

“Mr. Redzepagic is not a violent person,” she said.

Assistant U.S. Attorney Artie McConnell said that in 2015, Redzepagic traveled to Turkey — a common point of entry into Syria for those joining ISIS or Jabhat al-Nusra — and made numerous attempts to cross the border. In 2016, authorities said, he made another unsuccessful attempt to enter Syria from Jordan.

Redzepagic’s parents offered to put up the family home, worth an estimated $580,000, as collateral to ensure that he will return to court to face the charges, Felder said.

The couple’s guarantee, and restrictions offered by Felder, including house arrest and electronic monitoring, were not sufficient to persuade Tomlinson to release Redzepagic.