Answer in first paragraph of Airplane Hijacking - Wiki:

Aircraft hijacking (also known as aircraft piracy, especially within the special aircraft jurisdiction of the United States, and informally as skyjacking) is the unlawful seizure of an aircraft by an individual or a group. In most cases, the pilot is forced to fly according to the orders of the hijackers. Occasionally, however, the hijackers have flown the aircraft themselves, such as the September 11 attacks of 2001. In at least three cases, the plane was hijacked by the official pilot or co-pilot.[1][2][3][4]

1. China Airlines Flight 334

2. "Air China pilot hijacks his own jet to Taiwan". CNN. 1998-10-28. Archived from the original on 2008-03-21. Retrieved 2007-01-25.

3. B. Raman (2000-01-02). "PLANE HIJACKING: IN PERSPECTIVE". South Asia Analysis Group. Retrieved 2007-01-25.

4. Ethiopian Airlines ET702 hijacking
Legalisms are in footnote 3.

Regards

Mike