WASHINGTON — A federal judge in Florida struck down the mask requirement on airplanes, trains, buses and other public transportation on Monday, less than a week after the Centers for Disease Control and Prevention had extended it through May 3.

The ruling left it up to individual airlines and local transit agencies to decide what to do, and by late Monday, the nation’s largest airlines had dropped their mask requirements for domestic flights. The Amtrak rail system said passengers and employees would no longer need to wear masks.

In a 59-page decision, Judge Kathryn Kimball Mizelle, who was appointed by President Donald J. Trump, voided the mandate — which also applies to airports, train stations and other transportation hubs — nationwide on several grounds, including that the agency had exceeded its legal authority under the Public Health Services Act of 1944. Because of the ruling, the masking order was not in effect for the time being, and the Transportation Security Administration would not enforce it, a Biden administration official said on Monday evening.

The official said that the administration was still reviewing the decision and assessing whether to appeal it, and that the C.D.C. still recommended that people wear masks in enclosed public transportation settings.

It remained unclear to what extent local transportation agencies would seek to keep their mandates in place. Earlier in the day, before the administration official said the T.S.A. would not enforce the mandate, several state and local transit agencies across the country suggested they would keep their mask requirements for now.

Still, governments and businesses across the nation have largely loosened precautions, and now new known coronavirus cases are sharply rising again. When the C.D.C. extended its mask rule last week, it cited a desire to assess the potential severity of the Omicron subvariant known as BA.2, which recently became the dominant version among new U.S. cases. (On Monday, the city of Philadelphia reinstated a mask mandate in response, becoming the first major city to do so.)

President Biden had called on the C.D.C. to impose a mask mandate for travelers shortly after his inauguration, and the agency did so starting on Feb. 2, 2021. It extended that mandate several times. In July 2021, the Health Freedom Defense Fund, a Wyoming-based advocacy group, filed a lawsuit challenging its legality.

In a statement, the group called the ruling a “victory for basic American liberty and the rule of law,” and quoted its president, Leslie Manookian, as adding: “Unelected officials cannot do whatever they like to our personal freedoms just because they claim good motives and a desirable goal.”

In her ruling, Judge Mizelle adopted a narrow interpretation of the authority Congress granted to the C.D.C. to issue rules aimed at preventing the interstate spread of communicable diseases.

The law says the agency may take such measures as it deems “necessary,” and provides a list of examples, like “sanitation.” The judge wrote that this power was limited to things like cleaning property — not requiring people to take hygienic steps.

“If Congress intended this definition, the power bestowed on the C.D.C. would be breathtaking,” she wrote. “And it certainly would not be limited to modest measures of ‘sanitation’ like masks.”

If the government’s broader interpretation of the agency’s powers were accurate, she added, the C.D.C. could require businesses to install air filtration systems, mandate that people take vaccines, or even require “coughing into elbows and daily multivitamins.”

The ruling joins a tangle of litigation over various mandates attempting to curb the pandemic, most of which have centered on requirements, issued under various legal authorities, that different categories of people get vaccinated.

The outcomes of legal challenges to those mandates have varied. For example, a Federal District Court judge in Texas blocked an administration requirement that federal workers be vaccinated, but this month, an appeals court reversed that ruling.

In January, the Supreme Court blocked a Biden administration edict that large employers require workers to get vaccinated or submit to regular testing. But the Supreme Court has permitted military officials to take vaccination status into account when deciding where service members should be assigned or deployed — and on Monday, it allowed the Pentagon to take disciplinary action against a reservist who refused to get vaccinated.

After the C.D.C. and T.S.A. issued their guidance Monday evening, the nation’s four largest airlines — United, Delta, Southwest and American — said they were dropping their mask requirements, as did JetBlue, Alaska, Spirit and Frontier.

Amtrak also said Monday night that passengers and employees were no longer required to wear masks on its trains or in stations.

“Masks are welcome and remain an important preventive measure against Covid-19,” said Kimberly Woods, a spokeswoman for the agency. “Anyone needing or choosing to wear one is encouraged to do so.”

In the hours after the ruling, the Metropolitan Transportation Authority in New York City said it would keep its mask mandate in place. However, the Washington Metropolitan Area Transit Authority in the District of Columbia and the Southeastern Pennsylvania Transportation Authority in Philadelphia said that masks would be optional for passengers and employees.

President Trump appointed Judge Mizelle to the bench in November 2020, after he had lost re-election. A former clerk to Justice Clarence Thomas, she was 33 at the time, making her the youngest person Mr. Trump had appointed to a life-tenured judgeship. The American Bar Association declared her not qualified because of her lack of experience, but Republican senators confirmed her in a party-line vote.

Lawrence Gostin, a professor of global health law at Georgetown University, said the Biden administration would have to appeal the decision if it wanted the mandate to continue. He also defended the agency’s authority to issue the mask requirement.

“If there were ever an instance where the C.D.C. has authority to act, the classic case is to prevent the interstate transmission of a dangerous infectious disease,” he said.

In La Guardia Airport on Monday, passengers had mixed reactions to the ruling.

Patricia and Brendan Kennedy, who had just arrived on a Delta flight from Orlando, said the flight crew had reminded everyone to wear a mask on board.

Both said they would be happy not to have to wear masks in airports anymore, but they were divided about whether they wanted the requirement to remain in planes.

Ms. Kennedy said it made her feel better about flying. Mr. Kennedy said he was ready to be done with mask rules.

“I wish the whole thing would just go away,” he said.

At Terminal B, United employees checking in passengers were all wearing masks. A counter agent was surprised to hear that her employer was no longer requiring passengers to wear face coverings. That had not yet been communicated to her, she said.

Some in the airline industry greeted Judge Mizelle’s decision with relief.

David Neeleman, who has founded several airlines including JetBlue Airways and Breeze Airways, which started flying last year, said he welcomed the end of a mask mandate for passengers. Crew members at Breeze, where Mr. Neeleman is the chief executive, have been frustrated by having to police passengers, creating unnecessary tension in flight, he said.

“If the government can decide they can have the State of the Union address without masks, then we certainly should be able to let people have that choice on an airplane,” he said.

In her ruling, Judge Mizelle also faulted the agency for issuing the mandate under emergency procedures without delaying for public comment — rejecting the idea that there was no time for that since the pandemic was then already a year old.

“The C.D.C. issued the mandate in February 2021, almost two weeks after the president called for a mandate, 11 months after the president had declared Covid-19 a national emergency, and almost 13 months since the secretary of health and human services had declared a public health emergency,” she noted. “This history suggests that the C.D.C. itself did not find the passage of time particularly serious.”

In stressing that 11 months had passed between when the president declared a national emergency and when the agency imposed the mandate, Judge Mizelle did not address the fact that there had been a change of administration in that time.

As of Sunday, there was an average of more than 37,000 new cases a day, an increase of 39 percent from two weeks ago, according to a New York Times database.

Though the figure remains far lower than the peak of the winter surge driven by an Omicron variant, experts believe that new cases are increasingly undercounted with the rise of at-home testing. Also, many people who are vaccinated and have received booster shots have not experienced serious illness from contracting the Omicron variant.

Pulling back on the travel mask requirement at this moment is “very, very concerning,” Saskia Popescu, an infectious disease epidemiologist and assistant professor at George Mason University, said.

“We’re definitely starting to see a trend up in cases,” she said. “My concern is that we may see what happened in the U.K., where they drastically pulled back restrictions and saw a significant surge, and this will contribute to rising numbers.”

Charlie Savage reported from Washington, and Heather Murphy from New York. Reporting was contributed by Madeleine Ngo and Noah Weiland from Washington, and Niraj Chokshi, Adeel Hassan, Ana Ley and Roni Caryn Rabin from New York.