Media playback is unsupported on your device Media caption The BBC's Emily Thomas: "Shocked travellers dropped to the ground"

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.

Image caption Paul Ciancia was reportedly carrying a note that expressed anti-government views

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.

'Suicide text'

The TSA named the killed officer as 39-year-old Gerardo Hernandez.

Eyewitness Vernon Cardenas, 45, of Los Angeles "All of the sudden we saw people running towards us. Our terminal was a dead-end terminal and there was only an emergency door but no-one had opened the door yet. We started hearing some shots. Then someone kicked open the emergency door and everybody started running down into the tarmac, down below the planes. Pretty crazy. Some people got injured, as you had between 100 and 200 people trying to squeeze through the small door. I went close to the exit but I didn't quite leave, just to keep an eye on my stuff. At that point there were just a couple of us in the terminal and that is when we saw the gunman walking towards us. He was acting confused. Taking his time. He looked towards us. As soon as he looked our way, we all ran outside."

Mayor Garcetti 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.

According to US media, the alleged gunman approached potential victims asking if they worked for the TSA, and spared them if they said no.

He pushed through screening gates and walked more than 100 yards (90m) into the secure area of the terminal, Mr Gannon said, where law enforcement officers caught up with him in a food court.

As he began firing in the terminal, "everybody pancaked down on the ground", passenger Lauren Stephens, who was checking in at the time, told Reuters news agency.

Then, when more shots rang out, "I just left my bag and I just ran like hell. Everybody ran. People were falling. People were just trying to help each other out."

Image caption A photo from the scene of the incident showed police officers standing near an unidentified weapon.

Image caption Outside, video footage showed a man in a wheelchair been taken to receive medical help.

Image caption TSA employees comforted each other outside Terminal 1

Image caption There were chaotic scenes as the terminal was hurriedly closed.

Image caption Nearly 750 flights were disrupted by the attack

Image caption The airport closure left traffic backing up on roads around the airport

Another witness, Leon Saryan, told CNN that the same man he had just seen shoot a TSA officer "calmly" walked toward him and asked, "TSA?"

TSA: An unloved agency Part of US Department of Homeland Security, Transportation Security Administration was created after 9/11 to beef up airport security

But critics say the 50,000-strong agency is ineffectual and even unconstitutional

Its introduction of full-body scanners and pat-downs at airports in 2010 was seen by many as highly intrusive

The TSA has received thousands of complaints about discourtesy, delays at checkpoints and damage to luggage during screening

"I just shook my head, and he kept going," Mr Saryan said.

A number of people were reportedly injured while fleeing the scene.

Various outlets reported the suspect was carrying a note that expressed anti-government views.

Little is known about him.

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.