Clayton Osbon, a JetBlue pilot, had to be restrained Tuesday after suffering a panic attack on board a flight from New York's JFK airport to Las Vegas.
The FAA called the incident a medical emergency.
The unruly captain was subdued by at least five passengers after his co-pilot locked him out of the cockpit after displayed potentially dangerous behavior.
The flight was diverted to Amarillo, Texas.
Osbon, a commercial pilot since 1989, was not at the controls but "began acting erratically, flipping switches in the cockpit and appearing confused."
Sources say that his co-pilot tricked him into going to the passenger area to check something, then locked the door and changed the security code.
"The captain of the plane just went berserk," passenger Wayne Honlnes said.
"He came out of the other end of the plane … came running back to the cockpit and he was shouting out numbers … 500 something. He started banging on the cockpit door."
While Osbon was in the cabin, an off-duty JetBlue pilot traveling on the flight managed to enter the cockpit and help land the plane in Texas.
JetBlue said in a statement:"Another captain, traveling off duty, entered the flight deck prior to landing at Amarillo, and took over the duties of the ill crewmember once on the ground."
"The aircraft arrived Amarillo at 10:11 am CT, and the crewmember was removed from the aircraft and taken to a local medical facility."
Passenger David Gonzalez, a former corrections officer from New York City, said he was sitting in the second row of flight 191 when he saw the captain storm out of the cockpit and rush toward an occupied bathroom.
Flight attendants struggled to control him and Gonzalez, 50, said the captain began moving in the direction of the plane's emergency exit.
Gonzalez said he had gone to help the flight attendant and asked the captain what his problem was. Gonzalez said the pilot replied, "You'd better start praying right now," and was shouting about Al Qaeda, a bomb, and the plane crashing.
"I was actually the one that took him down. I noticed he was very erratic," Gonzalez said. "He was pinned against the door. I was afraid he was going to knock down the door. I was able to put a choke hold on him."
"I was able to get him weak from cutting his wind pipe."
"When he buckled, I realized I had him where I need him. So I put a little more pressure, and that's when he almost passed out. So I threw him to the floor."
"That's when the team came in and started helping me … I just didn't want him opening up that door. I knew if he got in there, we wouldn't be sitting here now."
Gonzalez felt the man get weak and he passed out about three minutes later. The men, who took off their belts to tie his legs, as Osbon was reportedly able to break through plastic handcuffs, sat on the pilot until landing.