The plight of 3,500 people aboard the Grand Princess took a dramatic and complicated turn Friday when U.S. government officials ordered the cruise ship to dock at an undisclosed port after tests confirmed that 21 crew and guests were infected with the new coronavirus.

The ship, which has been in limbo for three days, was circling outside the Golden Gate late Friday evening after Vice President Mike Pence announced at a White House news conference that it will go to a “noncommercial port” and everyone aboard will be tested.

Guests of the cruise who test positive for coronavirus will be quarantined at U.S. military bases while any crew members will stay aboard the ship, Pence said. He did not say what would happen with those who do not test positive — and whether they would be immediately allowed to go home.

President Trump had other ideas, suggesting that all people onboard should be quarantined on the ship to prevent them from spreading the highly contagious pathogen.

“I don’t need to have the numbers double because of (the people on) one ship,” Trump told pool reporters Friday.

Now Playing:

He said he was leaving decisions on what to do with the passengers up to Pence, but “if it were up to me I would say, ‘Leave everybody on the ship for a time and use that as your base.’... I’d rather have them stay on, personally.”

The passengers and crew who tested positive were among 46 people with flu symptoms who took swab tests after members of a California Air National Guard crew in two helicopters rappelled onto the ship Thursday to deliver test kits.

Trump’s idea is about as bad as they come, said John Swartzberg, an infectious disease professor at UC Berkeley, because cruise ships “are a perfect petri dish for spreading disease.”

“In terms of people on the ship, what’s best for them is to get them off that ship,” Swartzberg said. “The longer they’re on it, the more chance they have to become infected.”

Another Princess Cruises ship, the Diamond Princess, was similarly stranded off the coast of Japan in February after several passengers tested positive for coronavirus and Japanese officials quarantined them onboard for weeks. Ultimately more than 700 people became infected and six died. Public health authorities worldwide condemned Japan for trapping the people on the ship, placing them at high risk of infection.

Several hundred American passengers eventually were evacuated from the Diamond Princess and flown back to the United States, where they were quarantined for two weeks. Forty-five of those passengers, including 22 at Travis Air Force Base in Fairfield, ended up testing positive for coronavirus.

The Grand Princess, whose home port is San Francisco, departed Feb. 21 for a trip to Hawaii with 2,422 passengers and 1,111 crew members. It was halted off the coast of San Francisco on its return because former passengers, from the ship’s February cruise to Mexico, tested positive for the disease days after they returned from their cruise.

That may be why more crew members than passengers tested positive.

“We’re going to get to the bottom of it,” Pence said, but “it’s very likely the crew on the Grand Princess was exposed on two different outings.”

Among the former passengers from the Mexico trip who later tested positive for the disease was a 71-year-old Placer County man who died Wednesday. Five residents from Sonoma, Contra Costa and Alameda counties who were on that cruise also were infected.

Cruise personnel, in coordination with the Centers for Disease Control and Prevention and the California Department of Public Health, were beginning Friday to contact passengers on the ship who need medication and distributed forms to request prescription refills.

Pence disclosed the news of the infections on the Grand Princess in the news conference just as health officials were informing the ship’s operators that passengers had tested positive, according to Princess Cruises.

Thus, many passengers first heard of the infections from television news, and some were upset.

“The communication from Princess or from the state of California or any officials has just not been forthcoming,” Robert Archer, a 65-year-old San Francisco resident on the ship, told The Chronicle. “We’ve basically been in the dark.”

Archer said all passengers have been confined to the staterooms indefinitely with no word about when that situation will change. Crew members wearing face masks and gloves are sporadically bringing food to the rooms, which are not being cleaned.

“We’re lucky that we have a balcony so at least we can get some fresh air,” he said.

Nobody in Archer’s group has been tested or is experiencing symptoms, he said.

“It’s kind of a surreal situation, really,” he said. “The general mood seems to be somewhat apprehensive, and that’s probably due to the total lack of information being given to us.”

The ordeal on the Grand Princess was among a series of disturbing developments in the Bay Area on Friday as the virus continues to spread. So far, 84 people in California have been infected, including 50 in the Bay Area and 330 in the United States.

Fifteen people have died, including one in California and 14 in Washington state. More than 102,000 infections have been reported worldwide, with over 3,400 deaths.

Eight new cases emerged in the Bay Area on Friday: three more in Contra Costa County for a total of four, one more in Alameda County for a total of two, and four more in Santa Clara County for a total of 24.

In San Francisco, which reported its first two cases on Thursday, officials announced Friday that they canceled the city’s St. Patrick’s Day Parade and urged people over 60, or those with health conditions, to stay home as much as possible, limit their outings, and avoid gatherings of 50 or more people. Davies Symphony Hall and the War Memorial Opera House suspended events for the next two weeks, and Mayor London Breed recommended that large events — including sporting event — be canceled for the next two weeks.

Several businesses, including Facebook, ordered employees to work from home while others made it optional.

Several schools, museums and civic facilities across the region shut their doors, including the Children’s Discovery Museum of San Jose, which closed until an employee who developed coronavirus symptoms is tested. Stanford University announced it would switch to online classes for the rest of the quarter and cancel in-person classes.

Coronavirus precautions even hit the Oakland A’s spring training in Arizona. Instead of approaching waiting fans and autographing baseballs, programs and other pieces of paper, players will pre-sign balls and toss them to fans, the team announced.

Back in San Francisco, the Giants met with health officials to discuss precautions for the upcoming season.

This article has been updated since it appeared in print editions to clarify that people over 60, or those with health conditions, should stay home as much as possible, limit their outings, and avoid gatherings of 50 or more people.

Chronicle staff writers Mallory Moench, Sarah Ravani, Heather Knight and Erin Allday contributed to this report.

Peter Fimrite and Michael Cabanatuan are San Francisco Chronicle staff writers. Email: pfimrite@sfchronicle.com; mcabanatuan@sfchronicle.com Twitter: @pfimrite @ctuan