A federal security agent has been killed and several other people wounded in a shooting at Los Angeles International Airport, officials say.
The Transportation Security Administration (TSA) said three of its staff had been injured, one fatally.
The suspect – named by the FBI as 23-year-old Los Angeles resident Paul Anthony Ciancia – was wounded by police and detained.
Hundreds of flights nationwide were affected by the incident.
LA Airport police chief Patrick Gannon told reporters a “lone shooter” came into Terminal 3 at 9:20 local time (16:20 GMT).
The suspect “pulled an assault rifle out of a bag and began to open fire in the terminal” inside the nation’s third largest airport, he said.
He then allegedly went to a security screening area and continued shooting.
“As you can imagine, a large amount of chaos took place in this entire incident,” Mr Gannon said.
It was the first time a TSA officer was killed in the line of duty, according to Los Angeles Mayor Eric Garcetti.
He said it was fortunate that the authorities had tackled the suspect because he had been armed with more than 100 rounds of ammunition.
A law enforcement official told the Associated Press that Mr Ciancia was shot in the mouth and leg by two airport police officers.
US media report that the alleged gunman approached potential victims asking if they worked for the TSA, and spared them if they said no.
Little is known about the suspect.
Mr Ciancia’s family in New Jersey told police on Friday they had received a text message from him saying he planned suicide, report US media.
“Their younger child got a text message from Paul [Ciancia] stating that there were some comments in there about his wellbeing and he wanted to possibly take his own life,” a New Jersey police chief, Allen Cummings, said.
Mr Cummings said he called Los Angeles police, who sent officers to Mr Ciancia’s apartment in the city.
Two roommates of Mr Ciancia told Los Angeles police on Friday they had seen him the day before and he had appeared fine, according to Mr Cummings.
A local hospital official told reporters that one of the injured was listed in a critical condition, while two other victims were in fair condition.
Some 746 flights nationwide were affected and 46 were diverted because of the incident, said airport officials.
Terminal 3 remains closed as the investigation continues.
President Barack Obama expressed concern about the shooting, but said he would leave law enforcement to talk about it.