Buy this photo Photo: Santiago Mejia, Special To The Chronicle Photo: Noah Berger, Special To The Chronicle Photo: Noah Berger, Special To The Chronicle Photo: Noah Berger, Special To The Chronicle Photo: Noah Berger, Special To The Chronicle Photo: Noah Berger / Special To The Chronicle 2017 Photo: Noah Berger / Special To The Chronicle Photo: Noah Berger, Special To The Chronicle

A yearlong battle in San Francisco City Hall ended Wednesday night when two factions on the Board of Supervisors reached a compromise on how much affordable housing to require in new market-rate developments.

The agreement between progressive Supervisors Aaron Peskin and Jane Kim, and moderate Supervisors London Breed, Ahsha Safai and Katy Tang, will require that 18 percent of the rental units be affordable in all projects approved between now and January. That quota will rise to 19 percent at the beginning of next year, and to 20 percent in 2019.

If a developer opts to build the affordable units at another location, the ratios get higher: from 30 to 32 percent.

“We are very proud the board has come together to make this happen,” Peskin said. He praised his colleagues for standing up to developers “who have lined their pockets by not moving the affordable housing dial forward.”

The two groups of supervisors have sparred for months over what housing philosophy would better protect the soul of San Francisco — one that prioritizes low-income families, or one that caters to middle-class residents who don’t typically qualify for subsidized housing. Peskin and Kim say the current plan benefits both populations.

It creates three tiers, one for very low-income people, another for moderate earners and another for the middle class, Safai said.

He noted that until now, San Francisco has had no policy to help families on the higher end of that spectrum — the teachers and firefighters who got squeezed out when the city’s economy picked up a few years ago.

Proposition C, which passed in June, set the affordable housing level at 25 percent, but required that it be revised after the controller’s office released a feasibility study.

That study, published in February, recommended a more conservative policy: 14 to 18 percent affordable housing in rental properties, increasing at a rate of 0.5 percent annually for the next 15 years.

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

Twitter: @rachelswan