A JetBlue flight bound for Las Vegas was diverted to Texas on Tuesday following what federal authorities described as erratic behaviour by the captain, who passengers said had to be restrained after he pounded on the locked cockpit door.
The FBI is investigating the incident on Flight 191 from New York, which had 135 passengers on board when the pilot-in-command decided to redirect the plane to Amarillo, Texas.
JetBlue said in a statement the flight was diverted due to a "medical situation" involving the captain but made no mention of any commotion on board.
Passengers who were on the plane described a chaotic mid-flight scene in which a man in a JetBlue uniform, apparently locked out of the cockpit, began banging on the door and demanding to be let inside. Passengers subdued him.
"People behind me, a bunch of big guys, started going up there and trying to help, and we found out that the guy banging was actually the pilot, and he was trying to get into the cockpit because the other co-pilot had locked him out," passenger Grant Heppes told Reuters.
"Everybody seemed pretty nervous," he added. "Nobody was sure what was going on. Everybody seemed very concerned."
Passenger Heidi Karg told CNN that the captain, before he was wrestled to the ground, had been pounding on the door saying, "I need the code. Give me the code."
Another woman on the plane said local law enforcement met passengers at the gate and interviewed them.
The plane, which took off from John F. Kennedy International Airport in New York, had been scheduled to land at McCarran International Airport in Las Vegas.
JetBlue said that following a medical situation with the captain, another captain who was travelling off-duty entered the flight deck prior to the landing and "took over the duties of the ill crew member once on the ground."
The crew member was removed from the aircraft and taken to a local medical facility. The airline brought in another aircraft and crew to take the passengers to Las Vegas, JetBlue said.
The Federal Aviation Administration cited an "onboard medical emergency" as the reason for the diversion, and said preliminary information showed the co-pilot became concerned that the captain had "exhibited erratic behaviour during the flight."
"The captain had exited the cockpit during the flight, after which the co-pilot locked the door," the statement said.
"When the captain attempted to enter the locked cockpit, he was subdued by passengers. After the flight landed safely, local law enforcement secured the pilot without incident and he was transported by ambulance for medical evaluation."
An Amarillo police spokeswoman declined to comment on the incident but said her department was assisting the FBI.
The incident was the second to involve erratic behaviour by a JetBlue crew member since August 2010, when a flight attendant upset after an altercation with a passenger bolted from a plane by deploying and sliding down the inflatable emergency chute.
Lawyers for the flight attendant in that incident, Steven Slater, later told reporters he had acted in part out of frustration with the chaos of air travel and that he was under stress because his mother was suffering from lung cancer.
Two weeks ago a flight attendant started ranting about a possible crash over the public address system of an American Airlines plane. She, too, was subdued by passengers and crew as the plane returned to the gate at Dallas-Fort Worth International Airport.