The U.S. Postal Service is nearing a settlement with 19 states and D.C. to govern how the agency handles mailed ballots and to suspend key pieces of Postmaster General Louis DeJoy’s controversial cost-cutting agenda, which has been linked to mail backlogs across the country, according to three people with knowledge of the negotiations.

State officials hope that an agreement, which could come as early as next week, will act as a firewall against challenges from President Trump on the legitimacy of mail-in votes by recognizing the states’ authority to preside over elections and how ballots are processed, said the people, who spoke on the condition of anonymity to provide details on the discussions.

The settlement would resolve federal court cases in Washington state, New York and Pennsylvania. Judges in Washington state and New York have already issued temporary injunctions prohibiting the Postal Service from implementing a number of DeJoy’s operational changes, some of which caused postal workers to leave mail behind. The changes included adhering to stricter transportation schedules that attempted to eliminate late and extra trips, key methods of ensuring on-time mail delivery.

Supervisors also sharply curtailed overtime hours, though DeJoy contends he had no role in such directives. The Postal Service this summer also removed close to 1,500 public mailboxes and nearly 700 mail-sorting machines and cut some retail window hours.

Chief Judge Stanley A. Bastian in the Eastern District of Washington barred the Postal Service from enforcing DeJoy’s transportation policy, decommissioning any mailboxes and sorting machines, closing any processing facilities or cutting retail hours. Judge Victor Marrero in the Southern District of New York ordered USPS to afford election mail with first-class privileges and to preapprove all overtime hours between Oct. 26 and Nov. 6.

Justice Department lawyers, representing USPS, agreed Friday with the group of 16 voters who brought the suit to a revised order that largely adhered to Marrero’s original injunction. The sides did not agree on language about overtime policy and will continue negotiations on the topic, according to court documents.

A proposed universal settlement would combine requirements from Bastian and Marrero’s orders, plus potentially any others handed down by Judge Gerald A. McHugh Jr., of the Eastern District of Pennsylvania, who is yet to rule on a separate case brought by Pennsylvania Attorney General Joshua Shapiro (D) and four other jurisdictions.

“From the start of this case, our goal has been to stop the drastic operational changes at the Postal Service that have impacted mail delivery nationwide and endangered a free, fair and safe election,” Washington Attorney General Robert Ferguson (D) said in a statement. “Our preliminary injunction accomplished that goal while the case moves forward. I am hopeful that we can reach a final resolution that halts these damaging changes for good. Regardless, the Postal Service must follow Judge Bastian’s order — and we will accept nothing less.”

Shapiro and Ali Najmi, who represents the New York voters, and a Postal Service representative all declined to comment.

“One of the real challenges right now is, whether you support any new changes being made or oppose them, we’re getting to the point where even good changes could have a negative impact because of voter confusion and lack of ability to plan,” said David Becker, executive director of the nonprofit, nonpartisan Center for Election Innovation & Research. “If this can bring certainty, that’s a very positive thing.”

Bastian and Marrero’s orders offered scathing rebukes of DeJoy’s cost-cutting initiatives and the Postal Service’s election mail policies. Bastian wrote that the 14 states in his lawsuit proved that DeJoy, a major GOP financier and former supply chain logistics executive, and President Trump were “involved in a politically motivated attack” on the nation’s mail service.

Marrero wrote that the plaintiffs in his case would “likely succeed” at trial in proving that USPS lacked “legitimate justification for rolling out (and retaining) [DeJoy’s] policy, which has contributed to meaningful documented delays in service, in the middle of a pandemic when service standards were already impaired and a vast influx of mail-in ballots expected.”

McHugh, in oral arguments in the Pennsylvania case, also appeared to question the Justice Department’s argument about the postal changes. All three cases largely center on the question of whether DeJoy’s actions amounted to a change in agency policy. If they did, USPS would be required to obtain an advisory opinion from the Postal Regulatory Commission before putting the changes into practice.

The Postal Service contends that directives encouraging the elimination of extra and late trips were aspirational and did not originate from the agency’s headquarters, and thus are not official policy.

In the Pennsylvania case, Justice Department lawyers argued that DeJoy’s changes were managerial and operational decisions, not policy changes, and that the mail delays resulted from an “incorrect understanding of national policy.”

To which McHugh responded: “What would you call a ‘transformational initiative?’” — as the changes were labeled on internal documents.

“Defendants take the remarkable position that nothing has changed in the Postal Service’s approach to election mail from past years. This is simply not true,” Bastian wrote in his order. ” … Plaintiffs have made an extensive showing of irreparable harm that is caused and will be caused by the Postal Service’s ‘Leave Mail Behind’ policy and the Postal Service’s refusal to ensure that election mail will be treated as First Class mail to ensure timely delivery.”

USPS’s chief retail and delivery officer, Kristin A. Seaver, and chief logistics and processing operations officer, David E. Williams, issued guidance Monday to supervisors on how the agency plans to comply with the judges’ orders. The five-page memo obtained by The Washington Post states that USPS has not imposed a nationwide restriction on overtime and advised the “use of overtime necessary to expeditiously move Election Mail should be approved.”

It said the Postal Service would not decommission additional public mailboxes or sorting machines before the election but also noted there were no plans to reinstate ones that were already removed. Mothballed machines are generally disassembled and used for parts, the memo stated, and are therefore difficult to replace.

“Over the past month, however, a limited number of machines that were disconnected, but not dismantled and removed, have been put back into service,” Seaver and Williams wrote. “If it is determined that it is necessary to add processing capacity to fulfill our service commitments with regard to election mail, available processing equipment will be returned to service.”

They also stated that election mail would continue to receive priority over marketing mail and that it would be “processed expeditiously to the extent feasible” to receive first-class treatment.

“We are still reviewing the Postal Service’s plans, but it appears it is making an effort to comply with the order,” Ferguson, the Washington attorney general, said in a statement to The Post earlier in the week. “We will continue to monitor the situation, and will ensure that the Postal Service adheres to the court’s order to halt the damaging changes that have impacted mail delivery across the nation. I will accept nothing less than full compliance.”

Negotiators are still hashing out details on overtime hours and the handling of election mail, according to the three people with knowledge of the talks.

“Some of the language about election mail is also a little bit vague for us, whether they’re really going to treat it like first-class mail or not. It seems like there’s some wiggle room to us,” said one of the people, who spoke on the condition of anonymity to provide details on the discussions.