After years of opposing outdoor encampments, Oakland and Berkeley city leaders want to build safe versions of them for homeless people with nowhere else to go.

In Oakland, the City Council set aside $600,000 in its budget in June to establish an encampment of tiny homes on public land where people may be able to live for as long as five years. Unlike homeless encampments the city has shut down — or would like to because they pop up under bridges and along streets — the council expects to create a place where residents won’t have to worry about police rousting them.

Oakland Mayor Libby Schaaf’s short-term “community cabins” program — outdoor sheds where people can live for up to six months — recently opened its fifth site.

Berkeley’s City Council also set aside $615,000 in December to open the city’s first authorized outdoor emergency shelter. Homeless residents will live in about 50 tents on wooden pallets for three months at a time. Councilwoman Kate Harrison, who co-sponsored the shelter plan, said the city will hire an agency to manage the site, pick up trash and clean the toilets. Sinks, showers and syringe receptacles will also be available, she said.

Last month, the council directed the city manager to figure out where to put the shelter.

Both cities offer homeless shelters and navigation centers. But so many people are without homes that elected officials say they have no choice now but to include outdoor encampments in the range of help they offer.

“Because Oakland has such a large number of unsheltered residents, who are outside and in vehicles, it does demand a more crisis response,” said Councilwoman Nikki Fortunato Bas, who is leading the effort for a long-term encampment there. “That crisis response, I believe, has to recognize that the permanent housing is going to literally take years to create.”

Oakland has more than 4,000 homeless people living there — a 47% increase since 2017, when a count revealed 3,210 unhoused people.

The smaller city of Berkeley counted 1,108 homeless people last year, up 11% from 927 in 2017, according to official counts.

Neither city has enough shelter space for everyone who needs it, or enough affordable housing for those who could pay for it. In Oakland, thousands of people pitch tents in empty city lots and parks. Hundreds more live in RVs, some of which are inoperable. Far fewer people camp or park in Berkeley. But encampments are growing on Caltrans land under the Interstate 880 overpass at University Avenue.

Most city officials never dreamed they would endorse outdoor encampments as an appropriate long-term strategy.

Quite the opposite.

In 2017, about a dozen homeless people and their supporters established an unusual encampment in West Oakland’s Grove Shafter Park. Rejecting drugs and alcohol, the people created a “clean and sober” tent community. They called their place the Village. Advocates provided security, brought food and transported residents to laundries.

It lasted two weeks. That’s when Oakland police and Public Works Department employees shut them down and cleared them out.

Since then, Oakland officials have cleared out dozens of encampments. After clashes, however, they agreed to do so only when alternative shelter is available.

Berkeley, too, has a history of opposing encampments and RV parking. The council has passed ordinances prohibiting overnight camping in Berkeley parks and limiting the amount of sidewalk space people can occupy.

But as many laws as the cities passed, residents kept losing their homes — particularly in Oakland. Others earned too little to afford Bay Area rents.

“The encampments are going to continue,” said Needa Bee, a homeless woman who helped create the Village. “People squatting is going to continue. People living in cars is going to continue.”

Now, although the city councils in Berkeley and Oakland have each approved a small or imprecise plan for outdoor encampments, few public officials in either city agree on the best way to expand on those plans.

“There is not one perfect solution, and I know we would all love for this (homeless) problem to go away,” said Harrison, the Berkeley councilwoman who co-sponsored the outdoor emergency shelter plan.

Harrison developed the idea after seeing what Modesto created last February: a city- and county-approved homeless encampment with 150 tents under a bridge. That encampment proved successful, and residents are now moving into a new indoor shelter.

In Berkeley, not everyone on the nine-member council likes the outdoor plan.

“I think we can do better,” said Rashi Kesarwani, one of two council members who abstained. The other was Lori Droste.

Kesarwani said she wants to help as many homeless people as possible, but she considered the plan half-baked because it lacks a location, long-term funding and an exit plan into permanent housing.

In Oakland, the disagreements are broader.

Since 2017, Schaaf and her administration have touted their program of cabins made of sturdy drywall with double-pane windows.

But critics say the six-month terms at the cabins are too short. While some who comply with encampment rules are allowed to stay longer, others end up back on the streets.

On the City Council, Bas said she will push for an alternative model that allows for longer stays and provides heated structures with power, kitchens and running water that the cabins lack. The council approved initial funding, but hasn’t determined a model yet.

Bas and Margaretta Lin, executive director of the public policy consultant group Just Cities/Dellums Institute, looked at similar approaches in Austin and Seattle.

Seattle has established villages of tiny homes with access to kitchens, restrooms and showers, as well as help with case management. The city has at least seven of the villages.

Similarly, Austin, Texas, created a 51-acre community of RVs and tiny homes. Those have kitchens and laundry services for chronically homeless people.

Lin said that what all the encampments should provide is a sense of dignity.

“There is a spectrum of different models, and it really needs to flow from understanding who is going to be living there and what are their needs,” she said. “A model that fits with the people.”

Sarah Ravani is a San Francisco Chronicle staff writer. Email: sravani@sfchronicle.com Twitter: @SarRavani