An American airliner was diverted yesterday after its captain had to be locked out of the cockpit and restrained when he appeared to have a breakdown and began shouting that a bomb was on board.

One passenger described how three hours into the flight, the captain of the JetBlue Airways flight from New York to Las Vegas walked to the back of the cabin to go to the toilet, before turning back towards the cockpit and speaking erratically to passengers on the way, only to become agitated when he was refused re-entry to the cockpit.

"Once he got back to the front of the plane I heard him scream, 'Let me in!'" said Grant Heppes, 22.

Gabriel Schonzeit told USA Today that he "went crazy" and began bellowing, "Iraq, al-Qa'ida, terrorism, we're all going down," while another passenger, Heidi Karg, said that he began shouting, "I need the code, gimme the code, I need to get in there."

This led the pilot to address the passengers over the speakers to call for him to be restrained, Ms Karg told CNN, leading to several men wrestling him to the ground. Fortunately many of those on board were private security officers on their way to a conference and were experienced in how to keep unruly people under control.

The rumpus led to the aircraft diverting to Amarillo in Texas, with the captain being carried out on a stretcher. JetBlue later confirmed that the captain had experienced a "medical situation". All of the passengers were interviewed as they left the aircraft, as the FBI began investigating the incident.