An Iraq war veteran took a gun out of his luggage and opened fire in a crowded baggage claim area at Fort Lauderdale's airport, killing five people, months after he showed up at an FBI office behaving erratically.
Esteban Santiago, 26, who was taken into custody straight after the shooting and questioned at length, was expected to face federal charges, 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 and were reviewing the suspect's recent travel.
Santiago, who had served in the US military, arrived in Ft Lauderdale shortly before 1pm [local time] on Friday on a connecting flight from Alaska, authorities said, when he retrieved a 9mm semi-automatic handgun from his checked luggage and began firing.
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, and surrendered to police. Mobile phone video posted on social media showed travellers kneeling and treating victims on the floor next to a carousel.
The gunman, who wore a Star Wars T-shirt, said nothing as he fired, witnesses told MSNBC.
"This is a senseless act of evil," said Florida Governor Rick Scott.
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 three dozen were taken to local hospitals with bruises or broken bones suffered in the chaos.
Piro said Santiago had turned up at an FBI office in Anchorage in November 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 that his mind was being controlled by a US intelligence agency ordering him to watch Isis (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.
An aunt said he came back from his deployment "a different person", MSNBC reported.
Flying with firearms is routine and legal in the United States as long as the guns are kept in a locked, hard-sided container as checked baggage.
The attack was the latest in a series of mass shootings that have plagued the United States in recent years, some inspired by militants with an extreme view of Islam, others carried out by loners or the mentally disturbed.