It took multiple airline passengers to subdue the captain of a JetBlue flight from New York’s JFK airport en route to Las Vegas after he was kicked out of the cockpit by the co-pilot and started slamming on the door and screaming.

Due to a “medical situation involving the captain,” the flight was diverted to Amarillo, Texas. A JetBlue statement says that the captain became incoherent during Flight 191 and the co-pilot was able to somehow get him out of the cockpit. At that point, he was locked out.

The captain then started running up and down the aisle and was banging on the cockpit door and yelling, all in an effort to get back in. One passenger told CNN that she heard him shouting, “I need the code, gimme the code, I need to get in there.” At that point, the co-pilot asked for help in controlling the captain.

Other passengers reported hearing the word “bomb.”

An off-duty New York City police officer was part of the group that subdued the captain and held him on the ground until the plane was able to land. An off-duty JetBlue pilot helped take over duties in the cockpit once order was restored.