An Alaska Airlines Boeing 737-400 plane is shown on final approach to land in San Diego, California April 4, 2016.
The flight from the Seattle area to San Francisco was diverted to Portland. Reuters / Mike Blake

An off-duty Alaska Airlines pilot, traveling as a passenger in the flight deck, attempted to deactivate the plane's engines during a mid-flight from Everett, Washington, to San Francisco.

The flight, designated as Flight 2059 and operated by Horizon Air, was redirected to Portland International Airport and executed a safe landing.

"The Horizon captain and first officer promptly responded, and engine power remained unaffected as the crew secured the aircraft without incident,'' Alaska Airlines said in an email statement.

The off-duty pilot, whose identity has not been disclosed by the company, is in custody, and the incident is under investigation by law enforcement agencies, including the FBI and the Port of Portland Police Department, according to the company.

All passengers were accommodated on a subsequent flight, as stated by Alaska Airlines.

Horizon Air, a regional carrier within the Alaska Air Group, offers flights from Everett, a northern Seattle suburb, to San Francisco, with a typical duration of approximately two hours.