(CNN) -- A pilot stuck in the lavatory may sound like the opening line of a joke, but it triggered a terror scare on a flight from Asheville, North Carolina, to New York on Wednesday evening.
Delta 6132 -- operated by Chautauqua Airlines -- was about 30 minutes from LaGuardia Airport when the pilot went to use the bathroom.
Unbeknownst to the crew, he became trapped in the lavatory because of a broken door latch.
(The sole flight attendant on the plane couldn't help him because she had entered the flight deck when he left, per security protocols that require two people to be in the cockpit at all times.)
"After trying unsuccessfully for several minutes to open the door, a nearby passenger heard the noise of the efforts and tried to help," said Peter Kowalchuk, a spokesman for the airline.
"When the passenger was not able to open the door from the outside, the captain told him how to notify the flight deck of his situation."
The passenger dutifully complied, but apparently had a heavy accent, which combined with the suddenly-missing pilot spooked the first officer.
The tense conversation between the crew and air traffic control was posted on LiveATC.net, a website that shares live air traffic communications.
"The captain has disappeared in the back, and uh, I have someone with a thick foreign accent trying to access the cockpit," the co-pilot says in the recording.
"The captain disappeared in the back, went to use the restroom. By all indications, what I'm being told is he's stuck in the lav and someone with a thick foreign accent is giving me a password to access the cockpit and I'm not about to let him in."
Air traffic control responds by saying: "You guys ought to declare an emergency and just get on the ground."
But later, the pilot suddenly reappears at the controls.
"This is the captain. I'm back in the cockpit. Lavatory door malfunction," he says.
The controller on the ground is cautious: "I just want to make sure: Was there any disturbance in the airplane?"
"Negative," the pilot responds. "The captain -- myself -- was in the lavatory and the door latch broke and had to fight my way out of it with my body to get the door open."
The first officer did the right thing in securing the flight deck when he was not able to personally confirm the status of the captain, Kowalchuk said.
"No one was ever in danger and everyone, including the good Samaritan who tried to help the (captain) as well as the crew, are to be commended for their actions," he added.
The plane, with 14 passengers and three crew members on board, made an emergency landing at LaGuardia with the pilot at the controls.
The FBI was on hand just to make sure everything was all right.