The National Riffle Association failed to convince a federal judge that the temporary closures of California gun shops prompted by the spread of the coronavirus was unconstitutional.

U.S. District Judge Andre Birotte in Los Angeles on Monday denied the NRA’s request for a temporary restraining order to prevent L.A. County from treating gun stores as non-essential businesses during the pandemic.

The judge said the city and county of Los Angeles didn’t overstep their authority given the significance of their goal to reduce the spread of the coronavirus and the appropriateness of store closures to achieve that goal.

“Today’s decision recognizes that the public health interest in curbing Coronavirus requires extraordinary measures to be taken to protect our public health and well being,” Kris Brown, president of Brady, a group advocating for gun control, said in a statement.

The county had said the NRA’s legal challenge was already moot because Los Angeles County Sheriff Alex Villanueva had allowed firearm stores to reopen on March 30. The sheriff reversed his decision to treat the stores as nonessential under state and local government orders after the U.S. Department of Homeland Security issued an advisory that guns and ammunition businesses are part of the U.S.’s essential critical infrastructure.

The judge said it was necessary to rule on the NRA’s request because L.A. County might reverse course again.

“Because Sheriff Villanueva’s shift in policy could easily be abandoned or altered in the future, plaintiffs’ Second Amendment claim against the county order has not lost its character as a present, live controversy,” the judge said.

Representatives of the NRA didn’t immediately respond to a request for comment on the ruling.