Esteban Santiago, 26, who was taken into custody immediately following the shooting and questioned at length, was expected to face federal charges in the shooting rampage, said George Piro, special agent in charge of the Federal Bureau of Investigation's office in Miami.
Piro said investigators had not ruled out terrorism as a possible motive in the rampage and were reviewing the suspect's recent travel.
Santiago, who had served in the US military, had arrived in Ft Lauderdale shortly before 1pm local time on a connecting flight from Alaska, authorities said, when he retrieved a 9mm semi-automatic handgun from his checked luggage and began firing indiscriminately.
Broward County Commissioner Chip LaMarca said on Twitter that the gunman went into a restroom to load his weapon and came out firing. Witnesses told MSNBC television he only stopped after running out of ammunition, at which point he surrendered to police.
Cellphone video posted on social media showed travellers kneeling and treating victims on the floor next to a carousel. At least two victims had pools of blood from apparent head wounds.
The gunman, who wore a "Star Wars' T-shirt", said nothing as he fired, witnesses told MSNBC.
"This is a senseless act of evil," Florida Governor Rick Scott told reporters.
A White House spokesman said President Barack Obama had spoken to Scott and Broward County Mayor Barbara Sharief and had extended his condolences to the loved ones of the victims.
In addition to the five killed, eight others were wounded by gunfire and some three dozen were taken to local hospitals with bruises or broken bones suffered in the chaos surrounding the shooting massacre.
Piro said that Santiago had turned up at an FBI office in Anchorage in November of last year behaving erratically and was turned over to local police, who took him to a medical facility for a mental evaluation.
A federal law enforcement official told Reuters that Santiago told agents at the Anchorage office in November that his mind was being controlled by a US intelligence agency, which was ordering him to watch Islamic State videos.
Santiago served from 2007 to 2016 in the Puerto Rico National Guard and Alaska National Guard including a deployment to Iraq from 2010 to 2011, according to the Pentagon.
A private first class and combat engineer, he received half a dozen medals before being transferred to the inactive ready reserve in August last year.
An aunt said he came back from his deployment "a different person", MSNBC reported.



