A United Airlines flight from Shanghai to Newark, New Jersey, was delayed several hours and eventually rerouted to San Francisco International Airport Sunday due to an unruly passenger wearing a "Make America Great Again" hat, authorities said.

United said the unidentified passenger tried to take another passenger’s seat while boarding flight 187 Shanghai Pudong International Airport. The elderly man allegedly refused to move and grew increasingly disruptive after he was asked to exit the aircraft.

Passengers were forced to de-plane at the Shanghai airport while local law enforcement dealt with the matter.

The man "eventually left the aircraft on his own accord" before the flight departed, a spokesman for United said.

Cellphone video captured by a passenger on the flight showed a crowd of travelers shouting "Lock him up!" as he was escorted off the plane and to the boarding gate.

The flight was forced to make an unscheduled stopover in San Francisco to get a new crew on board, adding several hours to the already lengthy flight. The flight was scheduled to arrive in Newark at 6:15 p.m. ET on Sunday, but didn't touch down in New Jersey until 2:22 a.m. Monday.

United thanked its customers for their patience and its staff for its professionalism.