Boeing agreed on Sunday to plead guilty to a felony charge of conspiring to defraud the federal government over two fatal crashes of the 737 Max in 2018 and 2019, according to a late-night court filing.

In the deal with the department, outlined in part in the court filing, Boeing also agreed to pay a $487.2 million fine — the maximum allowed by law — and invest at least $455 million over the next three years to strengthen its compliance and safety programs.

The company will be put on probation, supervised by the Federal District Court for the Northern District of Texas, for three years. As part of the probation, the Justice Department will appoint an independent compliance monitor who will make sure that safety measures are in place and followed, submitting annual reports to the government. The company will face additional penalties if any of the terms are violated. The company’s board of directors will also be required to meet with crash victims’ families.

The decision by Boeing to plead guilty is significant because the company has not been convicted of a federal felony in decades. In the filing, the department described the charge of conspiring to defraud the federal government as “the most serious readily provable offense.”

The deal reached on Sunday stems from violations of an agreement that Boeing had reached with the Justice Department in 2021 that it would make significant safety changes after the two deadly crashes. The department, during the Biden administration, has made it a priority to ensure that companies like Boeing follow through on such agreements.

The department and Boeing made a joint filing on Sunday night, notifying the District Court that they had agreed in principle. In the next week or so, the formal agreement will be filed. The court will then set a hearing for the company to formally enter its guilty plea. Victims’ families will be able to speak during that hearing.