An outbreak of hepatitis A, a dangerous but preventable disease that is spread through fecal contamination and attacks the liver, has gotten so out of hand in San Diego that the county government is handing out plastic poop bags and washing the streets with bleach.

The outbreak has killed 16 people and infected 421 since November, ravaging San Diego’s large homeless and illicit drug-using population. It could eventually cost the county health department up to a million dollars, a local health official estimated.

But San Diego could have avoided its hepatitis A crisis — or at least ensured it didn’t get this bad — if its homeless residents had better access to housing and the city provided the services they need to stay healthy, activists and public health experts say.

The problem isn’t limited to San Diego County, which has the fourth-largest homeless population in the U.S. Detroit, Salt Lake City, Santa Cruz, California, and areas of Colorado are also dealing with hepatitis A outbreaks. The Los Angeles Acute Communicable Disease Control team told HuffPost that, while L.A. doesn’t currently have an outbreak, officials are on the lookout. And because of the way the disease spreads — all it takes is touching a door handle after a contagious person who hasn’t washed their hands and then eating lunch, for example — these outbreaks could spiral into an even larger public health crisis.

Mike Blake / Reuters Homeless families and individuals line up to attend Project Homeless Connect in San Diego in 2015, a one-day resource fair. Local officials are trying to find ways to address an outbreak of hepatitis A.

“CDC does keep track of hepatitis A outbreaks nationally, but not all hepatitis A outbreaks are reported to CDC. Most are handled at the state and local levels,” CDC media officer Elizabeth Davenport told HuffPost.

The CDC did not comment further on the trend nationally. But the factors that contributed to the outbreak in San Diego are similar to those that could aggravate the problem in other cities: a dearth of affordable housing, problems with placing people in shelters — either because there isn’t space or rules keep them out — and the lack of enough free, 24/7 bathrooms and showers.

“We set up the environment for something like this to happen,” said Michael McConnell, a San Diego resident and small-business owner who is an advocate for homeless residents.

The San Diego outbreak is particularly troubling because most hepatitis A outbreaks are stopped by finding the source, such as a tainted food item, and eliminating it. But a common food source in San Diego hasn’t been identified. And as people continue to come into contact with contaminated human feces, the disease continues to spread — meaning the crisis is far from over. Hepatitis A is also spread through sexual contact and sharing of needles.

Dr. Wilma Wooten, director of public health services for San Diego County’s Health and Human Services Agency, said the current hepatitis A outbreak is the largest public health challenge the county has seen in the 16 years that she has worked there. “We certainly will see more cases and more deaths.”

Here’s how and why this has happened.

San Diego County Hygiene kits are being distributed in San Diego.

Finding public bathrooms can be a challenge

For most people, when they need to shower or use the toilet, there’s a bathroom nearby that’s clean, open and free. But that isn’t always true for homeless people, especially those in San Diego, where many are forced to defecate outside, including in encampments.

In 2015, San Diego had just three city restroom facilities open round the clock, the San Diego County grand jury that investigates government operations reported. San Francisco had 25. San Diego had spent more than a decade trying to solve the problem, but funding difficulties, lack of support from businesses and concerns that additional facilities would attract more homeless people downtown have stood in the way, the grand jury noted.

Last week, as the crisis expanded, the city was making 14 public bathrooms accessible 24/7, and the mayor’s office said the city is hoping to install more. City officials plan to open three new temporary tented shelters with restroom facilities and other services, they announced Wednesday. At least 30 hand-washing stations have also been installed around the city, with the option to add more.

Jonathan Herrera, the San Diego mayor’s senior adviser on homeless coordination, declined to comment on whether the lack of public facilities contributed to the hepatitis A outbreak.

San Diego doesn’t have nearly enough affordable housing

Homelessness in San Diego — and nationwide — stems in part from a lack of affordable housing. Californians have the highest poverty rates in the country, with one in five Californians unable to adequately support themselves or their families because of high housing costs. And the lack of affordable housing in San Diego has been exacerbated by the elimination of 10,000 “affordable dwellings,” or low-income units, since 2010.

As of January, there were 9,116 people in San Diego County living on the streets or in shelters. An annual report earlier this year by the Regional Task Force on the Homeless said the number of tents and hand-built structures downtown had increased 104 percent from 2016. The city has a “housing first” initiative based on a national model to provide permanent housing for homeless people as quickly as possible. The San Diego Housing Commission has committed more than 3,400 federal rental housing vouchers to address homelessness to date. But San Diego County still needs an additional 142,052 affordable residences, one nonprofit estimated.

Providing affordable housing is a good deal for taxpayers. In Los Angeles, which has the nation’s second-largest homeless population, the average cost for providing a person supportive housing is about $605 a month, compared with $2,897 in services needed for a person who is homeless, according to a 2009 study by the Economic Roundtable underwritten through the Los Angeles Homeless Services Authority.

But “without enough housing available for those overcoming homelessness, a large number of people have nowhere to turn but the streets,” said Deacon Jim Vargas, president and CEO of Father Joe’s Villages, one of the shelters at the forefront of assisting the homeless population in San Diego.

“We need to do a better job of preventing individuals from falling into homelessness in the first place,” Herrera, the mayor’s adviser, told HuffPost.

Shelter comes with rules

San Diego has 1,340 emergency shelter beds. But, according to the mayor’s office, the rules that govern admission to those shelters make many homeless people reluctant to use them. Some don’t want to be separated from a partner or pet, others don’t want to abide by curfews that conflict with work hours or they don’t want to leave possessions unattended on the street.

“Many are sleeping in tents, have shopping carts ― and their belongings, as meager as they are, they can’t take them in with them,” said Robert Moser, executive director of Catholic Charities for the Roman Catholic Diocese of San Diego. “There’s a reluctance to lose those things that they’ve latched on to as their safety net and possessions.”

But Amy Gonyeau, chief operating officer for the Alpha Project, a nonprofit that serves the homeless in San Diego, argues that “there is not sufficient shelter.” And while “it is true that some people are service resistant,” that is a “minimal amount of the homeless population.”

Nationwide, “most communities do not actually have enough shelter beds,” said Megan Hustings, the director of the National Coalition for the Homeless.

A deadly recipe

Like other cities, San Diego has a number of laws that criminalize activities that homeless individuals can’t always avoid, like sleeping in cars or camping in particular public places. Police often cite the homeless for encroachment. The city also regularly removes homeless individuals’ possessions from the streets in a process called abatement that homeless people say amounts to harassment.

In San Diego, people are “being forced into smaller and smaller areas downtown,” said Dr. Jeffrey Norris, who serves as medical director for St. Vincent de Paul Village, a nonprofit dedicated to ending the cycle of homelessness, based in downtown San Diego. “It’s a recipe for transmission of hepatitis A with such small quarters and people living on top of each other.”

San Diego is fighting hard to contain the outbreak. So far, 21,000 people in the county have received the first of two vaccine shots, Wooten said. Vaccine drives, local public clinics, and teams of nurses and police officers sent out on foot to offer vaccinations in areas with concentrated homeless populations are working together to reach more people.

But activists wish more had been done to prevent an outbreak in the first place.

And the deaths are piling up. Norris said one of his longtime patients died suddenly of hepatitis A in June.

“It was a wake-up call that this is killing people,” Norris said. “It’s killing people we know. It’s killing our neighbors.”

“We’re not a third world country,” added McConnell, the community advocate. “We should quit acting like we are.”

This article has been updated with comment from the CDC.