Santa Clara Unified School District leaders watched a steady flow of talented young teachers leave their district.

So they cleared three acres of school property, hired a developer, and spent $6 million to build 40 apartments with below-market rents. That was 20 years ago.

Since then, it's gotten much more complicated to build teacher housing, despite state efforts to make getting money for it easier. Construction costs have risen, neighborhood resistance in many cities has stiffened, and demands on school budgets have increased, education and housing experts say.

Take, for example, an innovative new teacher housing proposal in Palo Alto. In January, after four years of public hearings, raising funds, partners and community trust, the $87 million subsidized housing project received a final go-ahead from Santa Clara County leaders. The planned 110-unit building, already over budget with COVID delays, will offer subsidized apartments for teachers and staff from five school districts. It has yet to break ground.

Santa Clara County Supervisor Joe Simitian championed the project, building coalitions to secure three major elements: land, money and community support. "While it's simple at one level," Simitian explained, "it's not easy."

The challenge to build Bay Area teacher housing is not new, but some leaders are concerned about the slow progress to address the issue as housing prices and rents continue to climb. Despite frequent calls for subsidized apartments, few cities have found a will or a way to provide missing middle housing for middle-class earners like teachers.

Twenty years ago, then-Santa Clara Unified superintendent Paul Perotti set a few simple goals – use school property, keep rents well below market rate, and make the project pay for itself. He sought funding partners in state and federal government, as well as nonprofits. But taking the money would have required offering housing to renters not working for the school district.

"If we were going to do anything with them," he said, "there would be a million stipulations."

So the district went it alone, a process that took about three years and $6 million of bond funding. Casa del Maestro opened with 40 units in 2002, built on surplus school property. The debt is repaid with rental income. It was later expanded to 70 apartments.

The units have remained full since opening, and the complex now has a waitlist of 66 teachers and staff. Rents run between $1,820 and $2,395 for one- and two-bedroom units, well below the average rent in Santa Clara. District teachers, who start with a salary of around $73,000, are allowed to stay up to seven years.

Santa Clara Unified superintendent Stella Kemp said the apartment complex has been self-sufficient and remains a valuable recruiting tool. The district has even considered expanding the program.

"Very often, you lose employees because of these affordability issues," said Kemp, who has also served as a school administrator in San Mateo County. "We want to keep teachers. We want to have teachers as part of the community."

Thomas Bray, a third-grade teacher in Santa Clara, said the two-bedroom apartment in Casa del Maestro has allowed his wife and him to stay in the Bay Area. The couple, both teachers, waited about a year-and-a-half to get a spot, and hope to save enough money to someday buy a home.

"It's been great," said Bray, 32, adding that he hopes the district will build more. "How else are you going to get young teachers?"

In 2016, California lawmakers passed the Teacher Housing Act, designed to loosen up affordable housing regulations and funnel money toward projects.

Several districts in San Francisco, San Mateo, Santa Clara, Alameda and Contra Costa counties have considered building workforce housing in recent years. But only a few have been successful.

Jefferson Union High School District in Daly City expects to open a new apartment complex this spring on district property. The project was financed by a voter-approved bond.

Another 144 affordable units, primarily for educators but also for some public employees, are getting underway in the Mountain View Whisman School District as part of larger residential development. In Berkeley, school officials last year endorsed a proposal to create about 110 subsidized apartments for teachers and staff.

But plans in San Jose and Cupertino have been sidelined in recent years by neighborhood opposition.

School districts often have an abundance of the most valuable Bay Area asset – land. Bay Area districts in the five core counties have a combined 7,600 acres of excess property available for development across 900 sites, according to an analysis by researchers at UCLA and UC Berkeley.

Eliminating the cost to purchase land lowers development costs, but experts say challenges remain. Few school districts have the capacity to manage large construction projects, and most are reluctant to spend scarce resources on teacher housing instead of education.

Housing advocates say the effort to build in neighborhoods is often the most difficult political hurdle. School campuses with little-used recreation fields, empty parking lots and wooded parcels are found in single-family home neighborhoods.

While Casa del Maestro received strong community support, homeowners today are often reluctant to give up that empty space for new, infill housing.

"It was never easy," said Michael Lane, state policy director at regional think tank SPUR. "Until relatively recently, schools weren't expected to provide housing."

Changes to state law have made it easier to finance teacher housing, but voters decide whether to approve school bonds and residents have to embrace projects in their neighborhoods. "Everything has to align perfectly,' Lane said.

Meta, and its predecessor company Facebook, have made efforts to secure workforce housing in the mid-Peninsula. In 2016, Facebook began subsidizing housing for about two dozen teachers in the Ravenswood City School District, requiring them to pay 30% of their salary toward rent.

Anu Natarajan, lead of the Meta housing initiative, said the workforce housing program will be discontinued, and teachers will be offered apartments in the new Palo Alto project. Facebook gave a $25 million grant to boost construction.

But Natarajan said the missing middle housing remains a concern of Meta. "We're looking at this as a case study," she said.

Simitian spent years laying the groundwork for the planned affordable housing on Grant Avenue in Palo Alto. Neighborhood resistance has stiffened against development. "The answer to that is not only no, but hell no," he said.

In Santa Clara, the district was able to move forward through partnerships with developers and long-term financing, said Perotti, now retired in Gold Country.

No other Bay Area districts ever tried to duplicate the plan, Perotti said. Initially, no local districts ever asked. "None. Nada. Zero," he said, even as he helped other public schools around the country build similar projects. "To me, it's kind of ironic that it's still an issue."