An unnamed man from Atlantic City was found  hiding in the cockpit of a JetBlue aircraft gated at John F. Kennedy International Airport early Tuesday morning, reports NJ.com.

The aircraft had originated from the Dominican Republic and landed in New York City around 1:30 a.m. EST. According to a statement released by JetBlue, all other passengers had departed the plane.

Instead of deplaning, the man entered the cockpit where he was found by flight crew at approximately 2 a.m. “sitting by the window” in the cockpit. The stowaway allegedly told crew members that he was hiding from a group of people who were waiting at the airport to “jump him.”

The man was escorted from the plan, then handed into the custody of Port Authority Police. After being taken to the hospital, he was later arrested and charged with trespassing.

The airline has not released details of how the man was able to gain access to the cockpit without crew members noticing.