The San Francisco school board took a big step toward building apartments for some teachers and their classroom aides, a closely watched project that seeks to ease the housing crisis for educators.

The board voted unanimously Tuesday evening to enter into an agreement with Mayor Ed Lee’s office of housing and development to pursue the construction of up to 150 units on a former school site in the Outer Sunset neighborhood.

“I think this has been many, many years in the making, so this is a very big deal,” said board member Matt Haney.

For two decades, school officials have been mulling the idea of using surplus property to build the apartments. But in recent years, with a flourishing tech industry pushing San Francisco housing prices higher, teachers and their union have called for help, saying teachers increasingly can’t afford to stay in the city.

Several state, federal and local programs already offer rental assistance, eviction support and down payment assistance to buy a home, but proposals for teacher apartments on district property always stalled, until now.

“It is encouraging for us and the teachers to know the city is putting resources into the project and the district is as well,” said Lita Blanc, president of the United Educators of San Francisco.

Several Bay Area school districts are considering the construction of teacher housing to address the high cost of living, including Alameda, Oakland, San Jose and Newark.

In San Francisco, the school board will provide the land on a long-term lease. The city is expected to contribute about $44 million to the project, including funds from a voter-approved 2015 affordable housing bond.

A California law passed in 2016, authored by then state Sen. Mark Leno, D-San Francisco, allows cities to use state and federal tax credits to build affordable housing specifically for educators and use school district surplus land for the purpose. Prior to that, it was illegal to use the tax benefits and to restrict who could live there based on profession.

“We’re just beginning to attend to the fact that people earning up to $90,000 a year can’t afford market-rate housing,” Leno said. “We do not have sufficient housing for that income-level cohort.”

A beginning teacher in San Francisco makes about $57,000 and the median salary is about $70,000, not including health and pension benefits.

The agreement approved Tuesday allows the city to look for a developer to build on the Francis Scott Key Annex on 43rd Avenue, between Irving and Judah. City officials said the apartment building or complex would likely be four or five stories tall in a neighborhood with mostly single-family homes.

The process would take up to two years, including finding a developer, designing the complex, working with neighbors and going through environmental impact studies. The site currently hosts a community garden, playground and skate park as well as offices for administrative use.

Based on the agreement, 60 percent of units would be for eligible teachers and the rest for low-income teachers’ aides.

City officials say the property could house educators as early as 2022, after an estimated 18 months of construction.

Board members said Tuesday that the proposed housing is one of many creative approaches needed to address housing needs and teacher turnover issues.

“I’m really glad we’re moving forward on this,” said school board Vice President Hydra Mendoza. “This has been several years in the making.”

Jill Tucker is a San Francisco Chronicle staff writer. Email: jtucker@sfchronicle.com Twitter: @jilltucker