(CNN) — A federal judge in Washington, DC, ruled Thursday that changes Postmaster General Louis DeJoy made to the US Postal Service before the 2020 election hurt mail delivery, and has put in place orders to prevent DeJoy from doing the same again.

The decision, in a years-old lawsuit from Democratic-led state and local governments, is largely a response to mail across the country not being delivered on time at higher rates than normal in 2020. New York state and New York City, Hawaii, New Jersey and San Francisco-area governments argued that the slow-down impacted their ability to stop the spread of the Covid-19 virus, by impeding people from having a reliable alternative to in-person voting.

In mid-2020, the USPS cut back on the number of mail sorting machines it used, and also hindered the ability of workers to make extra postal trips that would result in them being paid for overtime. The changes — which Democratic politicians heavily criticized at the time because they dovetailed with then-President Donald Trump’s vocal opposition to mail-in balloting during the election — hurt on-time mail delivery.

DeJoy had made the changes without consulting the regulatory agency that oversees the post office first, Judge Emmet Sullivan wrote in his 65-page opinion Thursday.

“The evidence demonstrates that [the states and localities] suffered harm by impeding their ability to combat the spread COVID-19, impeding their ability to provide safe alternatives to in-person voting,” and by imposing costs and administrative burdens on state and local governments, Sullivan found.

Sullivan said the USPS couldn’t bar postal workers from making late or extra delivery trips without permission from the Postal Regulatory Commission, an independent federal agency.

“Although the simultaneous implementation of multiple policy changes in June and July 2020 contributed to the decline in mail service and the overall confusion by postal workers, the record evidence demonstrates that changes to and impacts on the USPS transportation schedule regarding late and extra trips were the primary factor in affecting service on a nationwide or substantially nationwide basis,” Sullivan wrote in a 65-page opinion Thursday.

Sullivan looked at whether the USPS had violated the law governing federal elections in making its service changes in 2020, and found the agency had not, according to his opinion.

“Though the implementation of the Postal Policy Changes contributed to the delay in mail deliveries nationwide, which in turn risked a delay in the delivery of mail-in ballots during an election season, USPS’s actions do not amount to voting regulations that override the States’ existing regulations,” Sullivan wrote.

Sullivan declined to appoint an independent monitor to oversee the USPS’ internal operations complying with the court’s orders.

In a statement, the Postal Service said it is “focused” on its critical role in the electoral process.

“Just as we always have been, the U.S. Postal Service remains fully committed to the secure, timely delivery of the nation’s Election Mail. Between now and the November election, we are highly focused on fulfilling our critical role as part of the country’s electoral system where election officials or voters choose to utilize us as a part of their process,” USPS said.

“We continue to believe that the lawsuit was not justified under the facts or supported by the applicable law. We are studying the opinion to determine our appropriate next steps,” the agency added.

(Copyright (c) 2024 CNN. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)

Join our Newsletter for the latest news right to your inbox