A federal judge granted a request from Costa Mesa, Calif., on Friday to temporarily block the transfer of up to 50 people who were in federal quarantine because of exposure to the new coronavirus to a complex the city said was not suitable to house patients who might have the infection and could pose a risk to public health.

The city said it was told the 50 people have been diagnosed with the virus and that the federal government and state of California planned to transfer them from Travis Air Force Base in California to the Fairview Developmental Center in Costa Mesa, about 40 miles south of Los Angeles. In its lawsuit against the federal government, several government agencies, the state of California and the California Governor’s Office of Emergency Services, the city repeatedly accused federal and state authorities of not informing or working with local authorities on the planned transfer.

The lawsuit’s allegation that as many as 50 people were diagnosed with coronavirus does not match up with the number of confirmed cases reported by the federal government on Friday. It remains unclear whether the lawsuit conflates with actual confirmed cases the people at risk of contracting the infection because they were in environments with greater exposure to the virus.

The federal Department of Health and Human Services said it does not comment on pending litigation. The Office of the Assistant Secretary for Preparedness and Response, which is within the HHS and is responsible for coordinating medical facilities, declined to comment.

“The Defendants’ plan was announced at the eleventh hour, with no efforts to include local government leaders or local public health officials,” the city said in its lawsuit. “The Plaintiffs now seeks to prevent Costa Mesa from becoming ground zero to a state and potentially nation-wide public health crisis caused because the state and federal governments have not sought to include local officials and emergency personnel in the planning and execution of their efforts.”

The restraining order prohibits state and federal government authorities from transporting anyone with the new coronavirus or exposure to the virus to Costa Mesa before a hearing at 2 p.m. Monday at the federal courthouse in Santa Ana, according to the Los Angeles Times.

Costa Mesa is the first city to sue the government in relation to the growing coronavirus outbreak, which has spread to more than two dozen countries, infected more than 76,000 people and killed more than 2,200, the vast majority in China. But in other places there has been an alarming surge in cases with no clear link to China, and some infectious disease experts think the flulike illness may soon become a pandemic and impossible to contain.

Costa Mesa argued that the Fairview Developmental Center, which previously served as a residential facility for people with disabilities, was “dilapidated” and surrounded by residential neighborhoods, meaning that housing coronavirus-infected people there could pose a risk to public health. The city also argued that Fairview was not equipped to handle coronavirus patients because it was recently deemed unsuitable for use as an emergency shelter by the California Department of General Services without two years’ and $25 million worth of work.

Before Friday, the number of confirmed U.S. cases of the new coronavirus was 15. The number more than doubled this week, in large part because the government repatriated Americans who had spent weeks in quarantine in Yokohama, Japan, aboard the Diamond Princess luxury liner — where the virus had spread to hundreds of passengers — and opted to include 14 passengers who tested positive for the virus on the flights back. On Friday, the Centers for Disease Control and Prevention said there were now 28 U.S. residents brought home from the cruise ship who have tested positive for the virus.

The CDC also said Friday that it has changed the way it counts confirmed cases. One category will be for Americans who were repatriated by the State Department from the cruise ship and from previous State Department evacuations from Wuhan, China, the center of the outbreak. These people were at higher risk for infection, and more are expected to test positive. The total number of people repatriated to the United States with the covid-19 infection is 31.

A second group of confirmed cases consists of 14 U.S. patients who picked up the infection either by traveling to China or from close contact with family members.

The government this month began quarantining Americans who visited Hubei province, where Wuhan is the capital, and banned most non-U.S. citizens who recently visited China from entering the United States. The restrictions were hastily issued, and states had little notice, prompting them to scramble to find places to quarantine returning travelers. Most people are being quarantined on military bases.

Lena H. Sun and Julie Tate contributed to this report.