San Francisco has reversed its 13-year ban on plastic bags and will now prohibit the reusable bags city leaders once championed because of the coronavirus.

The city announced the switch this week as part of its plan to curb the spread of coronavirus. Barring customers from bringing reusable bags, mugs and other household items into stores was adopted as a measure “to prevent unnecessary contact.”

San Francisco is not the only place that has reversed its reusable bag policy, but it is certainly the most surprising. The city was at the forefront of eliminating single-use plastic bags in 2007.

At that time, San Francisco’s board of supervisors linked plastic bags to a litany of scourges, including litter, climate change, big oil and endangering sea life.

But the coronavirus has changed all of that. As of Thursday afternoon, California was one of the states most ravaged by the virus, reporting 10,000 cases and 200 deaths in its population of almost 40 million.

Coffee shops in the states, including Starbucks and Peet’s Coffee, are refusing to fill up customers’ reusable mugs.

Other states also have moved to reduce the presence of reusable bags.

In New Hampshire, Gov. Chris Sununu issued an executive order on March 21 directing stores to use only new paper or plastic bags they provide and to refuse to allow customers to use their reusable ones.

“With identified community transmission, it is important that shoppers keep their reusable bags at home given the potential risk to baggers, grocers and customers,” he said.

Illinois, Massachusetts and Maine have imposed similar bans, or in some cases suspended their own state laws encouraging reusable bags.

Retailers across the country have jumped on board. Target has halted the sale of reusable bags, asking customers who bring bags from home to fill them at checkout.

Target, Trader Joe’s and other retailers are temporary waiving paper bag fees amid the pandemic.

One environmental group, Californians Against Waste, said it remains committed to reducing single-use plastic bags, but acknowledged the coronavirus does require lifestyle changes.

The group said on its website that single-use and reusable bags should be treated with just as much caution when it comes to washing and disinfecting them.

“As scientists learn more coronavirus transmission and lifespan, we will learn more about how we can reduce waste while protecting ourselves,” the group said.

• Stephen Dinan and Shen Wu Tan contributed to this report.