LANSING, Mich. (AP) — A federal appeals court late Wednesday halted a lower judge’s ruling and kept closed gyms and fitness centers that Michigan Gov. Gretchen Whitmer ordered shut months ago to curb the coronavirus.

The 6th U.S. Circuit Court of Appeals, in a 3-0 decision, granted an emergency stay sought by the governor. After a lawsuit was filed by indoor fitness facilities, District Judge Paul Maloney in Kalamazoo said last week that gyms could reopen at 12:01 a.m. Thursday.

>>YMCA stalls reopening plan after appeals ruling

Whitmer’s order, “even if imperfect,” passes muster under a “rational basis” test used to weigh its constitutionality, said Judges Julia Smith Gibbons, Deborah Cook and Chad Readler.

“Shaping the precise contours of public health measures entails some difficult line-drawing. Our Constitution wisely leaves that task to officials directly accountable to the people,” they wrote.

The judges said while the plaintiffs bear the very real risk of losing their businesses, the governor’s interest in combating the coronavirus “is at least equally significant.”

“To date, the disease has infected thousands of Michiganders, and it has shown the potential to infect many more. That the public interest weighs in favor of a stay is apparent for the same reason,” they wrote.

Whitmer has planned to reopen gyms, movie theaters and places like bowling alleys in much of Michigan by July 4 if COVID-19 case trends remain favorable, though she will not make an announcement this week after citing concerns about some outbreaks. In the less-populous northern part of the state, gyms and fitness centers got the green light on June 10 if they reduced class sizes and made other changes.

“Today three Republican-appointed judges got it right: In the fight against a global pandemic, courts must give governors broad latitude to make quick, difficult decisions,” said Whitmer spokeswoman Tiffany Brown. “The governor will continue to take the actions necessary to save lives.”