JIDDAH, Saudi Arabia — Saudi Arabia is quietly planning to raze slums in one of its largest cities to make way for newer, restored neighborhoods as part of a plan to keep up with soaring demand for affordable housing.

A gap between what is available on the market and what many Saudis can afford has left people frustrated and accusing the government of corruption. A shortage of low- and middle-income housing means millions of Saudis cannot afford to buy a home.

Young Saudis are affected since it takes years of saving before many can afford to buy a home, often a precursor to marriage.

To address the housing shortage and public grumbling, the Red Sea city of Jiddah is a testing ground for a plan that includes getting rid of most of its roughly 50 unplanned settlements, which comprise a third of its built-up area, according to municipality figures.

In their place, the city plans to build subsidized housing complexes for Saudis.

If this new model for revamping the kingdom’s second-largest city succeeds, it would be replicated throughout Saudi Arabia in areas where aging infrastructure needs overhaul.

The project is new, and even revolutionary, for a country where speaking openly about poverty is taboo and can lead to arrest. There are no official government figures on poverty levels in Saudi Arabia, and several Saudi-based research analysts say there are no mechanisms in place to permit studies on it.

In 2011, Saudi blogger Feras Bugnah was detained for several days with his crew for making a video on poverty that showed slum housing in the capital, Riyadh. Bugnah’s video said that 70 percent of Saudis do not own their own homes.

Discussion of poverty can lead to uneasy questions about the long-held social pact in Saudi Arabia, whereby citizens give their loyalty to the ruling Al Saud family in exchange for entitlements and benefits from the state.

Saudi Arabia is the world’s top oil exporter, the Arab world’s largest economy, home to some of the world’s super rich, and known for its cash handouts worldwide.

At the peak of Arab Spring protests in 2011, King Abdullah announced a $130 billion public spending plan that was largely seen as a move to buy domestic stability. He raised the monthly minimum wage to $800 and set aside about $70 billion to build 500,000 apartments for low-income Saudis. He promised millions more for the government’s housing loan fund, vowed to fight corruption and pumped about $37 billion into a fund for lower-income Saudis to access interest-free loans for needs such as marriage and buying furniture.

But the billions of dollars in long-term projects have not satisfied the needs of the poorest Saudis.

Fayyaz Ahmad, associate director of real estate adviser Jones Lang LaSalle in Saudi Arabia, said a third of new entrants into the workforce cannot afford a house costing more than $133,000, which in a city such as Jiddah buys a small two-bedroom apartment.

“The government is doing a lot, but the population is large, and how to improve people’s access to cheaper loans is a real challenge,” he said. “There is no quick solution.”

With almost a third of Saudis under the age of 15 and more than half under 25, Nidal Taiba, vice president for development at the Jiddah Development and Urban Regeneration Company, said supply for affordable housing can’t keep up.

“It’s not for lack of effort that we have this shortage. It’s simply because demographics are working against us,” he said.

More in News

A wedding and special events’ planning business has agreed to pay a $200,000 settlement to five employees living in the country illegally after allegedly failing to pay them minimum wages and overtime and discriminating against them because of their race.

The CIA has concluded in a secret assessment that Russia intervened in the 2016 election to help Donald Trump win the presidency, rather than just to undermine confidence in the U.S. electoral system, according to officials briefed on the matter.