A cruise ship carrying 3,500 people, 21 of whom have tested positive for Covid-19, docked in the port of Oakland, California, on Monday, after spending the last several days idling just off the coast of San Francisco.

As the Grand Princess neared land, passengers lined the balconies and waved and some left the cabins where they had been in isolation to go on deck. As the ship sailed under the Golden Gate Bridge, passenger Karen Schwartz Dever said everyone was hollering and clapping.

US passengers will be transported to military bases in California, Texas and Georgia, where they will be tested for the new coronavirus and remain under a 14-day quarantine. The US state department is working with the home countries of several hundred international passengers to arrange their repatriation.

Twenty-three people who needed acute medical care were taken off the ship by Monday afternoon, though it was not clear how many of them had tested positive for the virus, said Brian Ferguson, a spokesman for the California Office of Emergency Services.

Many of the nearly 240 Canadians on board left the ship after the critically ill and stood outside two tents displaying Canadian flags. Canada and the UK were among the countries sending chartered flights to retrieve their citizens.

Robert Kadlec, assistant secretary of health and human services, said on Monday: “Our intent is to basically disembark about half the passengers today. Everyone will be screened initially today.”

The nearly 1,000 passengers who are California residents will head to in-state military bases, while residents of other states will complete the mandatory quarantine at Joint Base San Antonio Lackland in Texas or Dobbins air force base in Georgia, federal health officials said.

Unknown at the moment is the total number of infected people aboard the ship. The US coast guard sent the ship 45 tests, 21 of which came back positive for the disease.

The California governor, Gavin Newsom, and the Oakland mayor, Libby Schaaf, said at a Sunday news conference that it could take up to three days to disembark and transfer all passengers. None of the passengers will be released into the community before they undergo a 14-day quarantine, and those needing acute medical care will be first to disembark.

Libby Schaaf, mayor of Oakland, talks to reporters about the arrival of the Grand Princess cruise ship on Monday. Photograph: Rich Pedroncelli/AP

“This is a time that we must be guided by facts and not fears, and our public deserves to know what’s going on,” Schaaf said.

Public health officials in Santa Clara county, which neighbors San Francisco, on Monday announced its first death from the coronavirus – a victim in her 60s with no known travel or contact with infected individuals.

The arrival of the Grand Princess comes as the number of coronavirus cases in California has reached 114, with more than 500 cases registered nationally. At least 22 deaths in the US have been attributed to the virus.

A growing number of businesses are encouraging employees to work from home – including the tech giant Amazon, which advised employees in New York and New Jersey to stay out of the office through the end of March. Trading on Wall Street was briefly suspended on the New York stock exchange after oil prices fell.

On Monday morning, the port of Oakland was otherwise open for business like any other day, with trucks rumbling to and from the docks along the shoreline. At the Ports America terminal where the Grand Princess was expected to arrive, four large private passenger buses were parked, and workers in reflective jackets ushered press out of the area.

The Grand Princess’s crew will be quarantined and treated aboard the ship, Newsom said. Officials are still assessing where the ship will be docked after offloading its passengers. “It will not be here in the San Francisco Bay,” Newsom said.

Michelle Heckert, a Bay Area resident who was quarantined as a passenger on the ship, has been sharing songs about her experience aboard the Grand Princess. She said shipmates she had spoken with seemed to be in generally good spirits despite having to remain in their rooms.

“Most of the passengers I’ve been in contact with seem to be positive or at least trying to remain calm. Our balcony neighbors seem cheery, especially when they can go out and enjoy the sun. It feels like maybe the ship is more calm than outside viewers,” she said.

“Obviously people would love to get off, but we still have 14 days of quarantine, so it’s a bit bittersweet.”

Heckert said she and her family do not believe they will disembark until tomorrow, when they’ll be transported to Travis air force base, north-east of Oakland.

🎶 Stuck on a ship, scared as sh*t, but we’re all right 🎶



This quarantined cruise ship passenger is turning to music amid the coronavirus outbreak pic.twitter.com/U51lHEaKZn — NowThis (@nowthisnews) March 9, 2020

The Grand Princess captain, John Smith, reportedly said passengers would disembark according to medical priority. Those who are sick or need treatment have been first to disembark, according to ABC News, followed by Canadian passengers and those from California.

#HAPPENINGNOW This is what it looks like at Berth 22 @PortofOakland as those aboard #GrandPrincess are disembarking. So far, the 21 people who tested positive for #coronavirus are off. Next to disembark will be the passengers from Canada. Then the estimated 1000 from California. pic.twitter.com/etH6cYNnCU — Laura Anthony (@LauraAnthony7) March 9, 2020

Newsom’s announcement that the ship’s passengers would disembark in Oakland ignited local ire from a community that has long suffered in San Francisco’s shadow. The West Oakland neighborhoods bordering the port are historically some of the city’s poorest and most polluted. Residents called the state’s decision discriminatory.

But Newsom said officials had evaluated a number of ports, including those in neighboring Alameda and San Francisco, and chose the Oakland port because of its proximity to an airport and a military base. Officials said on Sunday that the 10-acre site in Oakland’s outer harbor was being cleared and fenced in preparation of Grand Princess’ landing.

Oakland city council members said they had not been consulted on the decision to dock the ship in their city, which was made by state and federal officials. The council member Rebecca Kaplan said she worried about a repeat of the flawed Diamond Princess cruise ship quarantine off the coast of Japan, where support staff who boarded the ship to help passengers and crew were themselves infected with the virus.

“What specific steps are being taken regarding the personnel who will be assisting and processing and transporting the passengers?” said Kaplan. “How will you make sure those staff aren’t exposed and then spread it around Oakland? Where will they be staying and how will they be protected?”

Oakland is currently without three top city leaders, after the city’s police chief was fired and its city manager and fire chief quit – putting the city in a uniquely vulnerable position when it comes to planning for and managing a crisis like this one.

“The fact that we are without all of them at once makes it harder to deal with challenges facing our community – including this challenge,” said Kaplan.

The Grand Princess had been forbidden to dock in San Francisco amid evidence the vessel was the breeding ground for a cluster of at least 20 cases, including one death, after a previous voyage. It was held off the coast on Wednesday so people with symptoms could be tested.

The Grand Princess cruise ship, carrying 3,500 people. Photograph: Fred Greaves/Reuters

Grant Tarling, chief medical officer for Carnival Corporation, said it was believed a 71-year-old northern California man who later died of the virus was probably sick when he boarded the ship for an 11 February cruise to Mexico.

The passenger had visited the medical center the day before disembarking with symptoms of respiratory illness, he said. He probably infected his dining room server, who also tested positive for the virus, Tarling said, as did two people traveling with the man.

Off the coast of Florida on Sunday, the Regal Princess cruise ship was awaiting test results for Covid-19 on two crew members, then cleared hours later to enter port, authorities said.

The Regal Princess was supposed to have docked on Sunday morning in Port Everglades but was instead sailing up and down the coast. The crew members in question had transferred more than two weeks ago from the Grand Princess.

Another Princess ship, the Diamond Princess, was quarantined for two weeks in Yokohama, Japan, last month because of the virus. Ultimately, about 700 of the 3,700 people aboard became infected in what experts pronounced a public-health failure, with the vessel essentially becoming a floating germ factory.

Hundreds of Americans aboard that ship were flown to military bases in California and other states for two-week quarantines. Some later were hospitalized with symptoms.

On Sunday, the US state department issued an advisory against travel on cruise ships.

“US citizens, particularly travelers with underlying health conditions, should not travel by cruise ship,“ the department said in a statement on its website. The federal Centers for Disease Control and Prevention (CDC) “notes increased risk of infection of Covid-19 in a cruise ship environment”.

The Associated Press contributed to this report