SAN FRANCISCO (CBS / AP) — Federal housing officials approved a preference plan that advocates said Thursday will help low-income minorities stay in increasingly unaffordable San Francisco.

The U.S. Department of Housing and Urban Development will allow San Francisco to set aside 40 percent of affordable units at a new senior complex for low-income applicants who live in certain districts. The agency informed the city of its decision on Wednesday.

READ MORE: 'He's In Good Spirits;' Former OPD Capt. Ersie Joyner Recovering After Shooting; Remains in ICU

San Francisco Mayor Ed Lee and other city officials had sought permission to reserve 40 percent of the units for people in the neighborhood where the new complex is located, but HUD officials rejected the plan as limiting equal access to housing in violation of fair housing law.

The rejection disheartened city leaders struggling to keep San Francisco affordable for residents, especially for dwindling numbers of African Americans who have left historically black neighborhoods for lower-cost suburbs.

In 1970, there were 100,000 African Americans in San Francisco. There are fewer than half that today even as the population has increased.

Supervisor London Breed, who is president of the board and pushed for the preference, welcomed the change of heart.

READ MORE: Fremont Neighbors Of Movie Director Joel Souza Stunned Over Shooting On Set Of Alec Baldwin Movie

“We’ve lost a large population of African Americans in San Francisco, but we’ve also lost a large number of middle-income San Franciscans,” she said. “It has been really difficult for people who grew up here to find affordable places to live once they become adults.”

The new plan gives preference to low-income people living in five rapidly gentrifying districts, including the Mission and Western Addition, where the new senior complex is located. The Western Addition once housed a thriving black community called the “Harlem of the West” before it was destroyed by redevelopment starting in the 1950s.

Still, the odds of scoring a spot in the federally subsidized complex remain daunting. For example, 6,000 people have applied for the 98-unit building.

HUD officials declined further comment Thursday. But in a letter to Lee, Gustavo Velasquez, the assistant secretary for fair housing and equal opportunity wrote that HUD is “keenly aware of the larger challenges faced by lower income residents struggling to live in high-cost areas.”

MORE NEWS: Pfizer Scientist Testifies Against Holmes in Theranos Trial

© Copyright 2016 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.