Facebook, like other Silicon Valley tech firms, has a complicated relationship with low-income residents who fear job growth sparked by the tech industry is driving up housing prices and rents.

Now, the Menlo Park tech firm wants to friend some of its most vocal critics by committing $20 million over five years for affordable housing, job training and assistance for tenants at risk of losing their homes.

The unusual contribution is the largest it has committed to alleviate the housing crisis, a problem that has long pitted the tech elite against the region’s poorest residents. Facebook has teamed up with a coalition of East Palo Alto community groups and the governments of East Palo Alto and Menlo Park to form the Catalyst Housing Fund. The company calls the partnership “unprecedented.”

“The current path is unsustainable. We have a housing and transportation crisis in Silicon Valley (and) in the Bay Area,” said Elliot Schrage, Facebook’s vice president of communications and public policy. “We know that either we will come together and address this crisis or Silicon Valley will not be Silicon Valley in 20 or 30 years. It will move to other parts of the country and world.”

Silicon Valley tech firms, including Facebook, say they’re shouldering responsibility for the influence their job growth has on the skyrocketing rents and housing prices in the region. But advocacy groups have been calling on tech firms from Apple to Facebook and Google to do more.

Facebook has the means to contribute. It raked in $7 billion in sales and made a profit of $2.4 billion in its third quarter.

While Facebook isn’t the largest employer in the Bay Area, its executives say they realize they need to work with their neighbors and others in the Bay Area to alleviate a problem that has rippled throughout the region.

“When you add our growth with Stanford’s growth, with Google’s growth, with Apple’s growth, with all the other companies in the region, then together it becomes a huge amount of growth,” Schrage said.

Facebook now has about 15,000 employees worldwide, and a large chunk are in Menlo Park. The city recently approved Facebook’s campus expansion after the company pledged to spend more than $7.8 million on affordable housing, which included subsidizing rents for teachers, firefighters and other public service workers. The expansion will add an estimated 6,550 jobs at the company’s headquarters and the partnership that Facebook announced Friday is separate from the development agreement it struck with Menlo Park.

Schrage said that the alliance hopes to expand its efforts to other parts of the Bay Area, but is starting locally with East Palo Alto and Menlo Park’s Belle Haven neighborhood.

Facebook said it has no estimate of how many people may be helped by its $20 million contribution. Making a dent in the housing problem is expensive, however, in an area where the average home sells for around $1 million.

About $10 million of funding will go toward projects in East Palo Alto, a racially diverse city of about 29,000 people near Facebook’s campus in Menlo Park. About 16 percent of the city lives in poverty. As of 2014, the median income of residents was $52,716, census data show.

Funding for projects within 15 miles of Menlo Park and East Palo Alto will be available.

The tech firm plans to hire an economic opportunity liaison to help link local residents to jobs at Facebook and to job training. It’s also contributing thousands of dollars for tenant legal assistance, emergency rent relief and Rebuilding Together Peninsula.

Facebook, which plans to contribute the funding in 2017, is hiring a third-party organization to track how the money is spent and to make the investments.

Tameeka Bennett, executive director of Youth United for Community Action, has seen firsthand the impact that the region’s rising rents have had on East Palo Alto.

Bennett lived in East Palo Alto for 28 years, but she said her family had no choice but to sell their home when they could no longer afford their mortgage payments.

“We were looking to purchase a home in East Palo Alto, but the prices were just sky high. I had to move to Oakland,” she said.

During the summer, a coalition of community groups, the American Civil Liberties Union and the law firm Public Advocates raised concerns about Facebook’s impact on housing prices as Menlo Park considered whether to approve its campus expansion for two new office buildings and a hotel.

A report by Keyser Marston Associates, a San Francisco real estate consulting firm, found that the tech giant’s expansion could have a “modest indirect influence” on the housing market, but it didn’t specify how much.

From 2010 to 2015, Facebook made up about 2 percent of the 230,000 jobs added in San Mateo and Santa Clara counties. The company represented about 5 percent of the additional 103,000 high-wage jobs — those with an average annual employee compensation of $100,000 — in the two counties, the report said.

Recognizing the need to work with Facebook to ease the company’s impact on its neighbors, the coalition of community groups — called Envision Transform Build-East Palo Alto — reached out.

“We came knocking on their door. This idea is something we wanted to do for a long time, but we needed a huge entity like Facebook to come to the table with us, treat us as equal partners and listen,” Bennett said.

Seeing that Facebook was being sincere about being a good neighbor, the idea took off from there, she said.

“We haven’t seen a tech tycoon and a low-income community come together in this way before,” Bennett said. “And we’re hoping it can be a model for other communities like ours that are facing this same issue.”

Facebook affordable housing and economic opportunity efforts

Here’s a breakdown of how some of the money will be spent:

-$10 million for projects in East Palo Alto

-$500,000 for housing-related policy initiatives

-$650,000 for job-training programs

-$200,000 for Facebook Culinary training programs

-$500,000 for tenant legal assistance and emergency rent relief

-$250,000 for Rebuilding Together Peninsula, for the rehabilitation and reconstruction of homes in East Palo Alto and Menlo Park’s Belle Haven Area

-Hiring of an economic opportunity liaison

Source: Facebook