This is The Last Line of Defense Between You and a Deranged Pilot

See the surprising last minute sanity check pilots must pass.

Captain Clayton Osbon suffered a major meltdown while at the helm of a JetBlue flight three years ago.

The hysterical and deranged pilot was restrained by his passengers at 35,000 feet. In a video of the incident he said, "I'm so distraught! We're going to get doomed!"

Former Fox News anchor Laurie Dhue was on that New York-to-Las Vegas flight.

She said, "He was very agitated and you could tell he was having a breakdown of some kind."

The plane and all its passengers could have been doomed, like those aboard the flight that crashed into the French Alps.

But the JetBlue passengers managed to restrain the pilot in the aisle, because co-pilot Jason Dowd had locked him out of the cockpit and wouldn't let him back in.

Dhue said, "He approached the cockpit door, banging on it loudly, saying,  ‘Let me in! Let me in!’"

It was a reverse of the situation on the tragic plane that went down this week, where the deranged co-pilot was in the cockpit and kept the pilot from entering by locking him out.

Retired American Airlines Captain Mark Weiss says pilots and co-pilots routinely check each other out before taking off.

He told INSIDE EDITION, “There's something very interesting in a cockpit. Very typically, when you get intoa  cockpit with somebody, you'll ask some questions, ‘Where are you based? What have you flown?’ To learn a little about somebody. If you feel uncomfortable about something, if you think somebody has had alcohol the day before, if you think there is a problem it's incumbent upon the person who feels uncomfortable to stand up and say something."

JetBlue co-pilot Jason Dowd's quick thinking saved the lives of 137 people.

Osbon was charged with interference with the flight crew after he was taken off the plane. He was found not guilty by reason of insanity. He now lives in obscurity in Georgia.

Those who were aboard that flight won't ever forget his breakdown at 35,000 feet.