A flight attendant accused of making bogus bomb threats on two Skywest flights in 2015 has signed a plea deal to avoid trial, but he could still end up spending decades in prison.

Justin Cox-Sever, 23, of Tempe, Arizona, is accused of making threats on a July 2015 flight from Charlottesville, Virginia, to Chicago, and on a September 2015 flight from Minneapolis to Dickinson, North Dakota. In the first incident, the plane had to turn around mid-flight. The second incident resulted in the temporary shutdown of the Dickinson airport.

Under the plea agreement filed Saturday, Cox-Sever will plead guilty to four of five charges accusing him of interfering with an aircraft. Prosecutors will drop a fifth count, reducing the potential maximum sentence from 70 to 50 years in prison. A judge must still approve the deal and an appropriate sentence. Cox-Sever also could face up to $1 million in fines and restitution, according to court documents.

The Associated Press on Monday requested comment from defense attorney Michelle Monteiro and Assistant U.S. Attorney Gary Delorme, who is prosecuting the case.

FBI Special Agent Daniel Genck wrote in an affidavit filed last year that Cox-Sever admitted planting a bag with towels on the North Dakota flight and reporting it as a suspicious package making beeping noises. Genck said Cox-Sever also admitted writing a threat on a wall of the plane’s bathroom in the Virginia case. Attorneys haven’t publicly discussed a motive.

Emergencies were declared on both flights. No injuries were reported.

Cox-Sever was charged in U.S. District Courts in North Dakota and Virginia, complicating the matter and resulting in his trial being delayed eight times. The cases were consolidated in federal court in North Dakota earlier this month.

Cox-Sever is no longer employed by SkyWest. The airline won’t say whether he quit or was fired.