Federal investigators arrested a Brentwood man Friday after a grand jury indicted the 25-year-old for allegedly attempting to join al-Qaeda in the Arabian Peninsula and conspiring to commit murder overseas, authorities said.

Prosecutors unsealed the indictment Friday in U.S. District Court charging Marcos Alonso Zea with conspiracy to commit murder in a foreign country and attempt to provide material support to terrorists, among other charges.

Zea, who also goes by the name “Ali Zea,” pleaded not guilty Friday through his court-appointed attorney at federal court in Central Islip, where his family sat in the front row.

Judge Arlene Lindsay ordered Zea held without bail, agreeing with prosecutors who said “the defendant poses both a risk of flight and a danger to the community.”

Investigators tracked Zea’s alleged terrorist activities back to 2011, when he allegedly conspired with others to travel overseas “in order to wage violent jihad on the perceived enemies of Islam, which included the secular government of Yemen,” authorities said.

On Jan. 4, 2012, according to the indictment, Zea flew from John F. Kennedy International Airport to London, where he planned to fly to Yemen in an attempt to fight alongside members of al-Qaeda in the Arabian Peninsula, a designated foreign terrorist organization also known as Ansar al-Sharia, but was intercepted by United Kingdom customs officials and was returned to the U.S.

Long Island Press patrons

That’s when authorities started keeping tabs on Zea, a federal source said.

Eight months later, Zea was secretly recorded bragging to another alleged conspirator, Justin Kaliebe, about lies he made to U.K. authorities and discussed Kaliebe’s alleged plans to fight jihad, according to the indictment. Kaliebe, who has since pleaded guilty to attempting to provide material support to terrorists, was allegedly provided money by Zea, who told him in a recorded phone call: “I just hope, my story… the event that happened to me will help you guys move forward, inspire you.”

After Zea learned in April 2013 that he was being investigated by the FBI’s Joint Terrorism Task Force, he asked an associate to erase the hard drive on his home computer along with two other hard drives he previously used, according to the indictment.

But investigators obtained the hard drives before they could be destroyed and discovered that Zea’s computers contained issues of Inspire, an al-Qaeda propaganda magazine, with articles such as “Which is Better: Martyrdom or Victory?” “Why did I choose al-Qaeda?” and “What to expect in Jihad?”

“When the defendant sensed investigators from the JTTF closing in, he engaged in a desperate effort to cover his tracks by attempting to destroy evidence—a tactic that only confirmed his violent aims,” Loretta Lynch, U.S. Attorney for the Eastern District of New York, said in a statement.

Nassau County police and Suffolk County police were among a half-dozen law enforcement agencies involved in the investigation.

Zea was also charged with attempt to provide material support to a foreign terrorist organization and obstruction and attempted obstruction of an official proceeding.

“This arrest is a vivid reminder of the threat we continue to face from domestic Islamic terrorists,” Rep. Peter King (R-Seaford), chairman of the Homeland Security Subcommittee on Counterintelligence and Terrorism, said in a statement.

Zea is due back in court Nov. 8 before Judge Arthur Spatt.