SAN FRANCISCO (AP) — A federal judge in San Francisco on Thursday ordered the Trump administration to implement energy-use limits for portable air conditioners and other products that were adopted during the last days of the Obama presidency.

The U.S. Department of Energy was required to put the energy efficiency standards into effect after a 45-day period to identify any errors and did not have the authority to continue to assess them, U.S. District Judge Vince Chhabria said.

The ruling came in two lawsuits — one filed by New York, California and other states and the other by environmental groups.

The U.S. Department of Justice did not immediately comment. The lawsuits over the energy standards are among a spate of legal actions challenging decisions by the Trump administration to roll back environmental protections.

The states argued that the new standards would reduce greenhouse gas emissions, save businesses and consumers billions of dollars, and conserve enough energy to power more than 19 million households for a year.

Chhabria gave the DOE 28 days to publish the standards — the step needed to make them legally enforceable.

The standards at issue also cover air compressors, commercial packaged boilers and uninterruptable power supplies. There is currently no federal energy standard for air compressors, uninterruptable power supplies or portable air conditioners, according to the states' lawsuit.

The Obama administration signed off on them in December 2016 and posted them online for a 45-day review period intended to spot any errors.

Chhabria said the Trump administration did not have the authority assess, modify or withdraw an energy standard after that period.

The other states in the lawsuit are: Connecticut, Illinois, Maine, Vermont, Washington, Massachusetts, Pennsylvania, Oregon and Maryland. The City of New York is also a plaintiff.