The pilots in the cockpit didn't know where the captain was. REUTERS

A captain who had jammed himself in the toilet caused a terrorist scare that very nearly led to a full scale military reaction.

The Chatauqua Airlines flight was in its final trajectory towards LaGuardia airport in New York when the pilot went to the toilet but unknowingly jammed the door and was unable to get out.

Realising he was trapped, the pilot banged on the toilet door asking for help. An unassuming passenger heard the trapped person and went to see how he could help.

The captain requested he contact the cockpit and following his instructions, the other crew members grew suspicious.

Stumbling, the co-pilot quickly radioed air traffic control.

"We are 180 knots 10,000 [feet] uh, can we leave the frequency for a minute? We are going to try to, uh contact dispatch," he said.

"The captain disappeared in the back, and, uh, I have someone with a thick foreign accent trying to access the cockpit."

Even having been told about the situation, the co-pilot followed protocol and didn't the man in.

"What I'm being told is he's stuck in the lav [lavatory], and, uh, someone with a thick foreign accent is giving me a password to access the cockpit," he said.

He added: "I'm not about to let him in."

Meanwhile, the captain managed to pry the door open, and explained what had happened and normality was restored.