Oakland leaders had ambitious goals three months ago when they sought to bring basic services and help to a squalid, needle-strewn homeless camp at 35th and Magnolia streets.

The idea, they said, was to offer a humane alternative to sending in cleanup crews and clearing the 39 homeless people out. Instead, city employees hosed off the sidewalks, added portable toilets and trash bins, and provided counselors to help get the campers into housing. They installed concrete barricades to prevent the camp from growing and set a March 31 deadline to get everyone housed.

Halfway through the effort, officials are finding out just how difficult it is to follow through with their bighearted intentions. They reunited one camper with family and shuttled 17 others into temporary shelter at the Henry Robinson Multi Service Center downtown, where they await permanent homes. More homeless people have moved into the camp, replacing those who left. Officials have no clear plan for how to shut down the camp by March 31. And the city’s involvement has stirred controversy, with some neighbors applauding the efforts and others denouncing them.

Perhaps the most entrenched problem facing the city is that many of the homeless people at 35th and Magnolia streets are addicted to heroin. No city official — from the Police Department to the city administrator’s office — would comment on what the city is doing, if anything, to crack down on drug trafficking, which area residents say moved from the camp itself to areas near their homes after the city installed the barricades.

Officials were caught off guard by the extent of heroin use in the sanctioned homeless camp, and outreach workers struggled to keep needles and syringes from piling up in the trash bins and bathrooms. Oakland’s contracted garbage hauler, Waste Management, stopped serving the camp in December, saying the used syringes pose a danger to workers. The city’s Public Works Department now picks up the trash.

“The heroin use was much more thorough-going than I expected,” said Sara Bedford, head of Oakland’s Human Services Department, which has teamed up with Councilwoman Lynette Gibson McElhaney’s office to oversee the camp.

It was McElhaney who conceived the Compassionate Communities idea and secured $190,000 in city funding to start the project in her West Oakland district. She deemed it a forward-thinking way to treat the city’s homeless —“as a constituency to be served, rather than a problem to be solved.”

“The goal was not to make this a cool place to live, it was to put people in housing,” McElhaney said. “We’ve seen that people living in this community have mental health and addiction issues, and those things are continuing to emerge. We knew this was loosey-goosey.”

At the same time, McElhaney noted, Oakland has made some progress. The camp used to sprawl four or five blocks, with tents spread among piles of feces and garbage, and the stench of urine wafting along 35th Street. Public works employees cleaned much of that up when the city adopted the camp. Now, there are trash bins and toilets, and campers sweep around their tents with donated brooms. The concrete barricades confine the camp to a one-block strip of roadway. Staff from the HIV Education and Prevention Project of Alameda County exchange syringes and distribute antioverdose medication each week. A nonprofit outreach team called Operation Dignity hands out food, blankets and toiletries, and helps assess the needs of individual campers.

“Everybody has been more inspired since the city got here,” said Kent, a 51-year-old resident of the camp who declined to give his last name. Gravelly-voiced and burly, he grew up three blocks away from the camp on Mandela Parkway. He became homeless six months ago after his marriage fell apart — he blames his crippling addiction to alcohol and crack cocaine.

“A year from now, I see myself in an apartment, with a job, off drugs,” Kent said. He is waiting for a slot in the Henry Robinson center.

In many ways, the Compassionate Communities experiment has revealed Oakland’s limitations. The scrappy East Bay city lacks the infrastructure of neighboring San Francisco, which spends about $45 million each year on direct homeless services — ranging from showers to street medical care — and an additional $196 million on broader assistance for the poor, including rental subsidies and eviction protections.

Oakland, by contrast, has an annual budget of just under $10 million for transitional housing, shelters, and food donations. And unlike San Francisco, Oakland has no official homelessness office or czar — such responsibilities have largely fallen on concerned council members and on the Human Services Department, which also runs the city’s Head Start and violence prevention programs, and services for the elderly.

Strapped for resources, some Oakland officials see sanctioned camps as a necessary, albeit temporary, fix for a complex problem.

McElhaney is stubbornly optimistic about the city’s odds of success.

“If everything goes as planned, then on March 31, everyone is housed, the site is decommissioned, and we take the services to another camp,” she said. “The street will get cleared, and then we’ll just patrol it like we would any other street.”

But success won’t come easy. Oakland’s most recent one-night homeless census, taken in January 2015, found 1,400 sleeping outside. With the next count scheduled to take place Jan. 31, the city’s homeless population has grown increasingly visible, with camps now brushing up against gentrifying neighborhoods and retail corridors. As rents continue to rise, longtime residents are getting squeezed out: Most members of the Compassionate Community camp grew up just blocks away, Bedford said.

Oakland officials “are doing the best they can with what they have,” said Sam Dodge, deputy director of San Francisco’s Department of Homelessness and Supportive Housing. “Because they lack funding, and given the time it takes to open all these programs, they’re kind of backed into these ‘meanwhile’ solutions.”

Several people who were recently interviewed at the camp said they tried at many points to find an apartment, but faced formidable obstacles.

“Every time I go to fill out the forms for a place, they want a credit check,” said Noel Cole, 51. “It costs $30 to $50 each time, and then I don’t pass, and they keep my money.”

Cole, a former salesman and warehouse stocker, grew up in North Oakland and attended Berkeley High School. He has been homeless since 2006 after losing a sales job in Stockton and becoming estranged from his father, who still lives nearby.

He was living in his car at the time Oakland started the Compassionate Community camp, but started coming by to use the toilets and get food donated by various churches and other charitable groups. When his car was towed a week ago, he began sleeping next to the camp, on a chair.

“The homeless thing, it’s in your face, now,” said Loris Mattox, executive director of the county’s HIV Education and Prevention Project.

Mattox and her staff weren’t at all surprised to find that many people at the encampment use heroin. She called the heroin use at the camp a small but representative sample of the opioid epidemic in Alameda County. To an increasing degree, Mattox and other health workers have seen ordinary people become over-reliant on prescription pain medications to cope with ailments or injuries. Many of them turn to street heroin, which is cheaper and has similar effects, after their doctors refuse to keep prescribing the medication.

“And when you see an increase in chronic homelessness, you see an increase in drug use to cope.” She added that many encampments — including the one at 35th and Magnolia — are composed of people with similar behaviors, meaning they tend to use the same substances.

Some residents of the surrounding neighborhood have grown to tolerate and sympathize with people in the encampment, and several told The Chronicle they are grateful that the city has stepped in. Others criticize Oakland for perpetuating what they say is a community blight.

Augie Ramos, a carpenter who lives just three doors away from the camp, said that because the city has put up concrete barricades at 35th and Magnolia, drug dealers can no longer park there — so they’ve moved their activities closer to his house. City staff put those barriers up in an attempt to monitor the camp and keep it from growing, but in the meantime, Ramos said, officials have largely allowed the drug problems to persist.

Containing the camp “did not make it better,” he lamented. “I just can’t wait until it’s over.”

Representatives of the Oakland Police Department declined to comment, and Bedford said she wasn’t aware of any concrete plan to curb drug trafficking around the encampment. McElhaney said that officers and other officials are tiptoeing around the drug issue.

“We’re aware of it, the police are aware of it,” the councilwoman said. “We’re telling (camp occupants) ‘We’re not trying to police your use.’”

It’s anybody’s guess what will happen when Oakland hits its deadline to close the camp. Bedford is confident the city will have some form of shelter for the original 39 campers, though she’s not sure what will become of the new people who have straggled in. The Henry Robinson center’s executive director, Jamie Almanza, said that anyone who lands at the 137-bed shelter has a good chance of finding housing, although it might not be in the form of a house or an apartment.

“We’re really focused on family reunification,” Almanza said, noting that about a third of the Henry residents who get shepherded into homes wind up living with kin — say, an estranged grandmother who still owns a house in East Oakland. Others find themselves a variety of creative living situations, from rented trailers to bunk beds.

“We had a gentleman who was incarcerated because he was a pyromaniac,” Almanza said. “We found him a $300 boat to rent.”

She said that in the three years since it opened, the Henry Robinson center has reached an 80 percent success rate of getting people off the street, and 90 percent of those people retain their housing a year later.

Whether Oakland has the money, time and staff to replicate its Compassionate Communities experiment somewhere else is another lingering question. McElhaney insists that the model can be transferred to another site, though she is depending on the city’s administration to find one and work out the details.

For the time being, she is willing to try other approaches to Oakland’s homeless crisis. Last year, the City Council set aside $80,000 for Laney College students to build two tiny-house models that officials hope to mass-produce this spring, and place on vacant public land or in donated church parking lots. And Alameda County voters overwhelmingly passed a $580 million affordable housing bond measure in November.

“I think everyone will be housed,” McElhaney said brightly. “My mind just doesn’t conceive of failure.”

Bedford, however, was more cautious, describing the Compassionate Communities project as an achievement by some measures, but also as a reality check.

“We’ve hit the edge of our existing resources,” she said. “We’ve learned we need more.”

Rachel Swan is a San Francisco Chronicle staff writer. Email: rswan@sfchronicle.com Twitter: @rachelswan