​A pilot who allegedly passed out in the cockpit of a Boeing 737 in Canada has been arrested on suspicion of being drunk.

Police in Calgary say Capt. Miroslav Gronych was “behaving oddly before he became unconscious in the cockpit” on Saturday, December 31, 2016.

According to CNN, the plane with 99 passengers and six crew members, was scheduled to fly to Regina before heading to Winnipeg and Cancun, Mexico.

Gronych, a 37-year-old Slovak national, was charged with having control of an aircraft while impaired.

“Initial tests conducted by police indicate the pilot was severely impaired by alcohol,” police said in a statement.

Budget airline Sunwing apologized for their pilot’s behaviour and commended the rest of the crew for their diligence in handling what they described as a “very unfortunate matter.”

The airline statement read: “Dear Customers, we will like to take the opportunity to advise you of an incident that occurred earlier this morning.

“We can confirm that shortly before 7 a.m. local time, the gate agents, first officer and crew of Sunwing flight 595, departing from Calgary and destined for Cancun, determined that the Captain was unfit to fly and reported this accordingly.

“The Captain was immediately escorted off of the aircraft and the incident is now under investigation with local authorities.

“We are very appreciative of our crew’s diligence in handling this very unfortunate matter in accordance with procedures.

“We were able to secure a new Captain and are pleased to report that our customers are now en route to their destination after experiencing a minimal delay.

“We are very apologetic for any upset that this has caused and would like to assure our customers that safety remains our utmost priority.”

Sunwing said the plane took off a short time after with a different pilot.