A former pilot accused of attempting to shut off the engines of a passenger jet mid-flight has pleaded guilty to the charges in a federal court.

Joseph David Emerson was riding off-duty in the cockpit of an Alaska Airlines flight when he told the pilots I am not okay before trying to cut the engines midair, court documents showed.

Emerson also told police he had taken psychedelic mushrooms and had been struggling with depression.

Under his plea agreement, prosecutors can recommend a one-year prison sentence, while his attorneys are expected to argue for no additional jail time.

He pleaded no-contest to reckless endangerment and first-degree endangering an aircraft in Oregon state court, and guilty in federal court, according to reports.

In state court, he was sentenced to 50 days in jail, which he has already served, five years' probation, 664 hours of community service, and $60,659 in restitution.

Multnomah County, Oregon, Deputy District Attorney Eric Pickard stated, What Joseph Emerson did was reckless, selfish, and criminal... he came close to ruining the lives of not just the 84 people aboard Flight 2059, but all of their family members and friends as well.

In court, Emerson remarked on his altered perception of reality after taking the mushrooms, stating, that doesn't make this right and described his journey of recovery towards being a better father and husband.

The flight on October 22, 2023, was heading from Everett to San Francisco and had to be diverted to Portland due to Emerson's actions. He was subdued by the pilots after resisting and later expressed regret for the incident.

Emerson's sentencing in the federal case is scheduled for November 17.