An Air India plane was forced to make an emergency landing after the pilot was locked out of the cockpit because he went to use the bathroom.

The Air India pilot struggled to get back into the cockpit which caused the passengers to panic. The flight was heading from Delhi to Bangalore, but the stranded co-pilot made an emergency landing in Bhopal.

Air India confirmed the incident and said that passengers were never in danger. They released a statement about what happened according to the Daily Telegraph.

"The commander had left the cockpit for a short while to visit the toilet. On returning, he found the door locked. All efforts to open it even from inside failed. The co-pilot, after taking permission from ground control, diverted the flight to Bhopal and landed at 5.55pm. The flight took off from Bhopal at 8.45 pm after clearance and reached Bangalore at 10.30pm.

"All precautions and procedures regarding safety were observed during the entire process. The incident posed no danger to the aircraft passengers and the crew."

This is just the latest safety incident that occurred on an Air India flight. Last month, two pilot were suspended because they allowed flight attendants to take control of a Bangkok to Delhi flight as the pilots slept in business class for forty minutes. The flight attendant accidentally turned off the auto-pilot, which put passengers in a dangerous situation. The pilots woke up and took control but four staff members have been suspended pending an investigation.

This wasn't the first time that a pilot was locked out of the cockpit either. In January a co-pilot who went to use the bathroom was locked out of the cockpit because the pilot had fallen asleep inside.

See Now: The U.S. had the highest number of Most Wanted properties, dominating the Hotels.com Loved By Guests Awards 2018