BERKELEY — A U.S. District Court judge threw out a lawsuit Tuesday that would have required a review of environmental impacts of a sale or relocation of services of the downtown Berkeley post office before any sale or relocation of services could take place.

While Judge William Alsup”s ruling favored defendant U.S. Postal services, it gave protections to the city of Berkeley and the National Trust for Historic Preservation, plaintiffs in the case.

The decision requires a 42-day period after the Postal Service finalizes a sale of the building or relocation of services, during which the sale or service relocation are enjoined and lawsuits can be reinstated. The decision also required the Postal Service to rescind its decision to relocate its services.

“While the cases were dismissed, the result of Judge Alsup”s order is actually quite favorable to the plaintiffs,” the Berkeley city attorney”s office said in an email, “because in order to render the cases moot, the USPS had to formally rescind its decision to relocate the post office from 2000 Allston Way. …

“The decision to relocate was the USPS”s first step in moving towards a sale. As a result, the USPS is back at square one, and there is no longer any decision to relocate postal services out of the Main Post Office at 2000 Allston Way.”

While the decision may stop the sale of Berkeley”s century-old post office in the near future, Brian Turner, attorney with the National Trust for Historic Preservation, said he had wanted the lawsuit to go forward so that the courts would make a clear determination on the question of whether, as plaintiffs allege, the postal service is required to follow the National Historic Preservation Act and National Environmental Policy Act.

“We would have liked to get to the heart of the matter,” Turner said.

The postal service contends it is not obligated to follow NHPA and NEPA requirements.

Alsup ruled the lawsuit was moot, because there was no service reallocation or sale pending, without which the question of an environmental impact was “hypothetical.”

Both lawsuits were initiated in September 2014, when a sale — later withdrawn — was pending.

The judge further wrote in his decision that a sale is unlikely. Given the city”s overlay ordinance which prevents most commercial uses of a cluster of downtown historic buildings, the restrictions “will substantially shrink the possible universe of purchasers or alternative users for the building, making it ever more unlikely that the controversy will ever rise from the dead,” Alsup wrote.

USPS spokesman Augustine Ruiz said in an email that the Postal Service was pleased with the court”s decision.

“Our plans are that retail postal services will continue to be provided at the (downtown post office) and if there is any change in that plan, we will engage in the requisite regulatory process,” he wrote. “The property is not currently on the market, and we are evaluating the situation in light of the court decision.”

Mike Lonergan, with Citizens to Save the Berkeley Post Office, said the ruling will prevent a “secret” sale of the building and that the organization will be evaluating its next steps.