Concerns about Silicon Valley’s housing shortage are turning the world’s leading social media company into an apartment developer.

Fast-growing Facebook Inc. is in the midst of a push to expand its headquarters complex in its hometown of Menlo Park, Calif., a plan for 6,500 new employees that has rankled some locals frustrated with crowding.

So in an effort to shore up city support, Facebook earlier this month made an unusual pledge for a tech company. It would build at least 1,500 units of housing, meant not specifically for Facebook employees, but for the general public.

The novel move is a gesture intended to address a growing frustration in the region: too many workers, too few homes.

“There is a lack of housing in the area,” said John Tenanes, Facebook’s head of real estate. “The intent here is to make an impact … it’s to try something new and something bold and to try to make a difference.”