The man accused of fatally shooting five people and wounding six others at a Florida airport has claimed his mind is controlled by the government and that he communicated with ISIS members through the dark web, according to new testimony.

Esteban Santiago, 26, initially blamed his actions on government mind control but later said he had been “on the dark web” communicating in “jihadi chat rooms,” the FBI testified in court during a detention hearing on Tuesday, according to the Sun Sentinel, Florida.

#Breaking: gunman also told FBI CIA was "controlling his mind." Santiago barely looked up during hearing. No emotion. pic.twitter.com/Epyox9B9g3 — Kara Duffy (@KaraDuffyCBS12) January 17, 2017

An FBI agent confirmed Santiago used a 9mm gun in the massacre at Fort Lauderdale-Hollywood International Airport on January 6. He had practiced firing the weapon at a gun range in Alaska in the months prior to the attack.

#FLL shooting update:

- 5 ppl dead

- 8 injured

- gunman in custody

- no second shooting https://t.co/Ge2VfVYJgPpic.twitter.com/lfbzUsInWk — RT America (@RT_America) January 6, 2017

The agent said it was the same weapon that Alaskan police seized when Santiago was hospitalized for six days for mental health problems in November, after the shooter turned himself in at an FBI office in Anchorage.

Santiago told agents at the Anchorage office that his “mind was being controlled by the government and he was being pushed to watch terrorist propaganda,” the Broward County Sun-Sentinel reported.

Prosecutors said when Santiago was released from psychiatric care, doctors believed he was “stable.” He was prescribed anti-anxiety medication and melatonin. The weapon, confiscated by police, was returned to Santiago in December, according to agents.

Santiago, an Iraq war veteran, was first interviewed by FBI agents and detectives at the airport.

“During the interview, the defendant admitted he planned the attack,” prosecutor Ricardo De Toro told the court.

“At various points…he said he carried out the attack because of government mind control,” Del Toro told the judge. “But he later said he did so because of ISIL…after participating in jihadi chat rooms.”

ISIL or ISIS is another name for Islamic State.

#BreakingNews: Gunman told FBI he was talking to "likeminded people" in ISIL chatrooms leading up to airport attack. pic.twitter.com/FtcdQXCDUE — Kara Duffy (@KaraDuffyCBS12) January 17, 2017

Santiago has not been formally charged but may face charges of shooting five people and injuring six others at the Terminal 2 baggage claim. He could face the death penalty if convicted.

US Magistrate Judge Lurana Snow ruled Santiago will remain in custody while investigations continue.

#NEW: judge denies bond for accused airport shooter, says he's a flight risk & serious danger to the community. pic.twitter.com/oR23gOL9XU — Kara Duffy (@KaraDuffyCBS12) January 17, 2017

He is due back in court January 30 for an arraignment hearing.