A US pilot who triggered a mid-air emergency when he suffered a breakdown in which he screamed about terrorists and 9/11 was ruled not guilty by reason of insanity, media reported.

Clayton Osbon, 49, had to be restrained by a number of male passengers after the incident in March, in which a JetBlue plane from New York to Las Vegas made an emergency landing in Amarillo, Texas.

US District Judge Mary Lou Robinson ruled in Texas that Osbon be sent to a federal mental health facility in Fort Worth for further examination before another hearing to be held by August 6, Amarillo Globe-News reported.

The pilot suffered a "severe mental disease or defect that impaired his ability" to understand that his midair meltdown was wrong, it said.

Footage filmed with cell phone cameras and broadcast on US television showed chaos at the front of the plane, as male passengers scrambled to help restrain the pilot, who could be heard shouting hysterically.

Between four and six passengers had to sit on top of him for up to 20 minutes as the plane, which was three and a half hours into its flight, made an emergency landing, witnesses said.

According to an affidavit, the pilot, who had shown no previous sign of mental problems, had arrived late for the flight, and began behaving erratically soon after the plane took off from New York's John F. Kennedy International Airport.

The first officer became particularly concerned when Osbon said "things just don't matter," and "yelled over the radio to air traffic control and instructed them to be quiet," according to the affidavit.

The first officer then suggested they invite an off-duty JetBlue captain who was on board into the cockpit, at which point the captain abruptly left to go to the forward lavatory.

When Osbon came out of the lavatory, he began talking to flight attendants, mentioning "150 souls on board," before walking to the rear of the aircraft, and then sprinting back to the forward galley.

At that point, the first officer used the plane's intercom to issue an order to restrain Osbon.