A man is in custody after walking on a plane.

A United Airlines passenger was taken into custody at Chicago's O'Hare International Airport after walking out onto the wing of the plane while it was taxiing.

Shortly after 4am, the flight from San Diego landed at Chicago O'Hare.

As the plane taxied to gate B3 the 57-year-old man pulled open the emergency exit and climbed out onto the wing.

A male subject was on a plane that was approaching the gate when he pulled the emergency exit and walked out onto the wing, according to a statement from the Chicago Police Department.

The subject slid down the wing onto the airfield.

The police arrived and took him into custody. There are pending charges.

Mary-Ellen Eagleton told Chicago's WGN9 news channel that a flight attendant ran down the aisle to ask what was going on.

She said that everyone was surprised and shocked.

We weren't even at the gate yet when he opened the door to the plane.

She said that the man had not acted erratically on the flight, and that most passengers had been sleeping.

Everybody was kind of in shock, we didn't know why he would do that.

A statement from United Airlines said that a passenger opened an aircraft door and left the plane as it was taxiing to the gate.

Our ground crew stopped the individual outside of the aircraft, and the person is now with law enforcement.

All passengers deplaned safely after the plane arrived at the gate. Our highest priority is the safety of our customers and crew.