(Reuters) - An Iraq war veteran accused of killing five people at a Florida airport told investigators he was inspired by Islamic State and previously chatted online with Islamist extremists, an FBI agent testified on Tuesday, U.S. media reported.

Esteban Santiago is taken from the Broward County main jail as he is transported to the federal courthouse in Fort Lauderdale, Florida, U.S., January 9, 2017. Amy Beth Bennett/South Florida Sun Sentinel via REUTERS

Esteban Santiago, 26, was ordered held in jail until a Jan. 30 arraignment, court records show. At that time he would enter a formal plea to charges that he opened fire in the baggage claim area of the Fort Lauderdale airport on Jan. 6.

“He has admitted to all of the facts with respect to the terrible and tragic events of Jan. 6,” Assistant U.S. Attorney Rick Del Toro said at the federal court hearing in Fort Lauderdale, NBC 6 South Florida television reported. “These were vulnerable victims who he shot down methodically.”

Reuters was not immediately able to reach U.S. prosecutors or the Federal Bureau of Investigation to confirm the media reports.

Santiago, a private first class in the National Guard who served in Iraq from 2010 to 2011, traveled from Alaska to Florida with a handgun and ammunition in his checked luggage, officials said.

Upon retrieving his gun case from the luggage carousel, he went to a bathroom to load the weapon and then opened fire on others waiting for their bags, investigators said.

FBI special agent Michael Ferlazzo testified Santiago told interrogators he carried out the attack on behalf of Islamic State and that he had been in contact with others on jihadist chat rooms who were planning attacks.

“It was a group of like-minded individuals who were all planning attacks,” Ferlazzo said, according to NBC 6.

The FBI has said Santiago previously displayed erratic behavior, entering the FBI office in Anchorage in November and saying his mind was being controlled by a U.S. intelligence agency.

The FBI turned him over to local police, who took him to a medical facility for a mental evaluation, officials said.

Police took a handgun from him but returned it last month after a medical evaluation found he was not mentally ill, authorities said.

Santiago used the same weapon in the airport attack, agents testified, the Sun Sentinel reported.

His defense team did not challenge the prosecution’s argument that Santiago posed a flight risk and said he was prepared to be detained through his trial, CNN said.