Each night at 6 p.m., San Diego’s New Life Assembly church opens its parking lot to dozens of people who will spend the night in their cars. The church is one of three sites in the city where the homeless can park overnight without fear of being ticketed or towed—or worse. It’s part of a citywide safe parking program started in 2010 to confront an increasingly visible face of the state’s homelessness epidemic: Californians sleeping in their cars.

As housing costs soar in major cities, more Americans are living behind the wheel. The U.S. Department of Housing and Urban Development doesn’t collect national data on vehicle residency, but unsheltered homelessness—a category that includes people sleeping in vehicles—is on the rise. In 2016, HUD counted 176,357 unsheltered people nationwide on a single night; last year, that number jumped to 192,875. In King County, Washington (which includes Seattle), about 3,372 people—more than half of the county’s unsheltered population—are living in vehicles. And in Greater Los Angeles, which has the largest unsheltered homeless population in the country, more than 15,000 people live in cars, vans, and RVs.

The car has become “a new form of affordable housing,” says Graham Pruss, a researcher and former outreach worker for Seattle’s Road to Housing program, a city initiative that helped residents living in cars find more stable housing. In the tight housing markets of West Coast cities, it’s not just the destitute or the unemployed who see their cars as their best option. “I have met people who are working at Amazon and rent an RV to live on the streets of Seattle while they’re saving enough to get into their own place,” Pruss said.

After years of crackdowns, cities from Santa Barbara, California, to Kirkland, Washington, are trying a new strategy: safe parking programs. San Diego’s program, run by the nonprofit Dreams for Change, has three lots with 150 spaces. The program has 325 residents—more than two people share a car, in some cases—ranging from families to retirees to tech workers making nearly $100,000 a year. And they sleep in models ranging from a Honda Civic to a Lexus. “Most of the time you walk through the parking lot, you wouldn’t know that they are a parking lot full of individuals living in their cars,” said Teresa Smith, CEO of Dreams for Change.

Americans living in cars find themselves at once exposed to street crime like theft and vandalism and reluctant to call the police for fear of costly tickets or impoundment. But it’s a gamble that even those with access to a shelter are willing to take. With doors that lock and a watertight roof, cars offer a sense of safety, privacy, and autonomy—even if parked on a public street—that tents and emergency shelters do not.

As vehicle residency grows, local governments have largely responded by trying to legislate it out of existence: Cities are moving to tighten parking restrictions or ban vehicle residency altogether. From 2006 to 2016, the number of bans on vehicle residency increased 143 percent among 187 cities surveyed by the National Law Center on Homelessness and Poverty. Seattle has 20 ordinances criminalizing vehicle residency, according to a 2016 report from Seattle University’s Homeless Rights Advocacy Project. San Diego, too, has sought to crack down with laws that ban vehicle residency and prohibit RVs from parking on the streets between 2 and 6 a.m.

Behind these laws—often championed by neighborhood groups and businesses—is the concern that vehicle residents, especially those in RVs or campers, will bring more noise, trash, and crime into neighborhoods, as well as take up parking space. Vehicle residents are fighting back. Los Angeles’ ban on vehicle residency was struck down by a federal court four years ago, after four vehicle residents sued the city. The court ruling found that the “cryptic” law was used to discriminate against the poor. (The city then prohibited vehicle residents from parking overnight near homes, parks, and schools.)

But even as these battles go on, nonprofits and, in some cases, city governments are trying a more accommodating approach. In San Diego, lots run by Dreams for Change have strict rules: no RVs, no entry after 10 p.m., no residents with records of violent crimes or sex offenses. There are no security guards anymore; instead, residents take turns supervising the lots themselves. Each parking space costs $2,950 per year to operate, Smith said, which goes toward the case manager’s salary and portable bathrooms. Case workers visit seven days a week, and about 35 to 40 percent of residents transition to housing within three to eight months of arrival.

But not all programs have had that level of success. Seattle’s attempts to create a safe parking program in the past two years have racked up expenses and produced few results. The first lot opened in 2016 with 25 spaces, but was shuttered that same year after the city spent $16,800 per space and found permanent housing for only 11.5 percent of the residents, according to the Seattle Times. The second lot, a “safe zone” located in the SoDo neighborhood, had 12 spaces, each costing the city $5,300. A case worker visited just once a week. Three residents died—two older men with chronic illnesses and a young woman who had struggled with a heroin addiction. The zone was scheduled to be shut down at the end of July; it’s unclear if that has happened. Mayor Jenny Durkan’s office did not respond to Slate’s repeated requests for comment.

“It was a terrible site,” said Rev. Bill Kirlin-Hackett, director of the Interfaith Task Force on Homelessness, referring to the safe zone. “It had inadequate outreach to it. It really wasn’t a pathway out of homelessness for anybody there.”

Perhaps the greatest test of safe parking programs is underway now in Los Angeles, America’s homelessness capital. Safe Parking L.A. opened its first lot this spring. The nonprofit now runs three lots with about 34 spaces and plans to open more.

Safe Parking L.A. lots, which are overnight only, have security guards on site. Each lot costs the nonprofit about $100,000 a year to operate. The residents don’t all come every night, and access is first come, first served. Residents meet with case workers during the day. About five or six people have transitioned to housing since the first lot opened earlier this year, according to Pat Cohen, one of the nonprofit’s founders.

Even well-run efforts can feel like a drop in the bucket. The average stay at Dreams for Change has increased from three months to six or eight months, which Smith chalks up to San Diego’s skyrocketing rents. At times, the program’s waitlist has surged as high as 150 vehicles.

Lola Cheatham has stayed at Dreams for Change’s safe lots for about two years. The 36-year-old mother sleeps in a minivan with her three children. She’s one of many vehicle residents who have found more privacy and safety in a car than in a shelter. But her search for affordable housing has been complicated by long waitlists and rents that remain out of reach.

“Every once in a while I go through a burst, ‘I’m going to find some housing, it’s going to be okay,’ ” she said. “And then about a week and a half into it, I get really discouraged.”

Not all residents will successfully make the transition to housing that the programs advertise. And funding constraints have forced some nonprofits to scale back their safe parking programs in favor of continuing to fund shelters and other homeless services.

But the programs want to help vehicle residents in the interim. Naomi Lender and her 14-year-old son spend the night in an SUV at a Dreams for Change lot. The 46-year-old San Diego native hopes to secure housing before the start of a new school year. But that’s fast approaching, and she has been at the lot since last October. Things weren’t always so uncertain for Lender; she said she grew up in a “huge house” in a “nice neighborhood.” She never imagined herself living in her car until she had no other choice.

“People who are homeless in general, whether we’re living in our cars or not, we’re not all here because we want to be,” she said. “It’s not because we’re lesser humans. It can happen to anybody.”