Hong Kong announced a series of strict pandemic control measures on Wednesday, including suspending flights from the United States and seven other countries, as it scrambled to contain an incipient coronavirus outbreak.

The new measures will deepen the city’s isolation from the outside world and mark a return to the tough restrictions the city imposed in the early days of the pandemic. Hong Kong has largely brought the coronavirus under control, but the arrival of the highly transmissible Omicron variant threatens to fuel a new wave of cases.

“Given the very dire situation of the pandemic, we have to grasp this critical moment,” Carrie Lam, Hong Kong’s chief executive, said at a news conference.

Mrs. Lam had said as recently as Tuesday that no new social distancing measures were expected. But the spread of Omicron, including the infection of a person with no clear connections to the city’s first detected Omicron cluster, evidently forced a change.

“We have to contain the pandemic to make sure there will not be a major outbreak in the community again,” she said. “We are racing with Omicron.”

The restrictions will make it even harder to enter Hong Kong, which already imposes some of the world’s longest quarantines — up to three weeks — on arriving travelers. Under the new rules, no flights will be allowed from Australia, Britain, Canada, France, India, Pakistan, the Philippines or United States for two weeks, starting on Saturday. People who have recently been in those countries will also be barred from entering Hong Kong by other routes.

Large public events will be canceled, and several types of public venues — including bars, gyms and karaoke parlors — will be closed. Visitors will be barred from hospitals and nursing homes for two weeks. Dining in restaurants after 6 p.m. will be banned. But the government decided not to stop in-person instruction in schools, or to require government officials to work from home.

Hong Kong has reported a growing number of imported cases involving the Omicron variant, with 133 as of Tuesday.

“If this continues, there will be tremendous strain on our quarantine and health care facilities,” said Dr. Ronald Lam, Hong Kong’s director of health.

An Omicron outbreak in the city has been traced to a Cathay Pacific flight attendant who ignored quarantine requirements after returning to the city from the United States. He dined at the Moon Palace restaurant in the upscale Fashion Walk shopping mall on Dec. 27, infecting his father and at least one other person, who then infected others.

The Hong Kong health authorities ordered a Royal Caribbean cruise ship on Wednesday to return to port ahead of schedule, as officials searched for people who had contact with a Covid-19 patient.

Nine people who boarded the ship, the Spectrum of the Seas, on Jan. 2 had come into contact with the patient, who did not board, the government said in a statement. The people were told to quarantine, though preliminary tests of them were negative.

John Yoon contributed reporting.