Housing the homeless will initially cost San Francisco a lot more money as people get the medical care they didn’t have on the streets. However, within a few years the higher costs will begin coming down on every front — emergency care visits, behavioral health services, welfare and food stamps — though how far they will fall remains to be seen.

Those are some of the conclusions suggested by a report from the city’s budget and legislative analyst being released Tuesday.

The report tracked the cost of providing services to 1,818 homeless adults from 2007-08 to 2014-15 who entered supportive housing between 2010 and 2012. The study analyzed the amount of money the city spent on services for them before they entered supportive housing and in the years after.

It found that after the adults entered housing, the cost of services increased dramatically as they took advantage of medical care they hadn’t sought before. For example, there was a 199 percent increase in the costs of emergency care, from $11.3 million to $33.9 million, and an 85 percent increase in the cost for behavioral health services, from $3.1 million to $5.8 million.

After that initial spike, however, the costs declined every year thereafter. The total cost of emergency services dropped to $14 million by 2014-15. The same is true for behavioral health services, which dropped to $3.3 million in 2014-15.

The study did not analyze the costs beyond 2015, but Supervisor Mark Farrell, who requested the report, said the statistics indicate the cost of services will continue to decline every year the people are housed.

“It is incredibly expensive for the city of San Francisco to treat our homeless population on the streets,” Farrell said. “And, first and foremost for their own health, but also for the financial health of our city, it is in the best interest of everyone to get them in some form of housing or services.”

The city’s homeless problem has become one of the most visible and contentious issues at City Hall. Mayor Ed Lee recently launched a Department of Homelessness and Supportive Housing with an annual $160 million budget and nearly 200 employees.

Yet there are competing theories for how the city should invest its resources.

Supervisor David Campos has introduced legislation to require the city to open at least six innovative long-term homeless shelters, known as Navigation Centers. But Lee and some moderate supervisors, including Farrell, oppose the legislation. They believe the city should dedicate its money to opening permanent supportive housing.

The budget and legislative analyst’s report makes it clear that caring for people even after they are housed isn’t cheap.

The city’s total services cost — not including housing — was 11 percent higher in 2014-15 compared with 2007-08, before the group of homeless people studied were housed, the report found. The costs shifted the longer people were housed, from emergency care to routine primary care.

Budget and Legislative Analyst Severin Campbell, who helped write the report, said the costs rose because “more people were served and they were getting more services.” In other words, more people were going to the doctor, getting therapy and accessing public benefits like food stamps.

“Our takeaway was that overall the city is going to incur costs, but it was a better form of costs, and what people were getting was a better form of care,” Campbell said.

The report doesn’t look at the costs accrued by agencies like Public Works and police in dealing with the city’s homeless population. The agencies expend a lot of money and manpower breaking down tent camps and cleaning streets.

Bevan Dufty, Mayor Ed Lee’s former point person on the city’s homeless policy, said “the major unanswered question” is how much those agencies save by moving homeless people into housing.

“This (report) is only one view of the costs, because a lot of the money the city is spending is through street cleaning, courts and police,” Dufty said.

Beyond the costs, the report analyzed what percentage of people stayed in supportive housing. Seven percent of the 1,818 homeless adults tracked in the study died. Of those who are still living, roughly half stayed in the housing and half left.

The report doesn’t look at the reasons why they left, but Dufty said if residents don’t pay rent — usually around 30 to 50 percent of their income — they are forced to leave.

“We have strayed far from the city’s goal of housing first. Evicting people who are not violent from supportive housing undermines the city’s commitment,” Dufty said.

Sam Dodge, deputy director of the new Department of Homelessness and Supportive Housing, said the report provides an important assessment of the costs associated with housing homeless people. But he said looking at the money alone also doesn’t tell the whole story.

“If we want to follow that economic logic, then the most cost effective thing would be for people to die on the street. And that’s not what we want to do,” Dodge said. “The reason we want to house people is because it’s not OK to have people living on the streets.”

Emily Green is a San Francisco Chronicle staff writer. Email: egreen@sfchronicle.com Twitter: emilytgreen