RIYADH, Saudi Arabia — Mohammed Iqbal joined the throng of foreign workers bound for Saudi Arabia during the oil boom of the 1970s, after recruiters from Pepsi visited his native India and dangled an opportunity in the kingdom driving a delivery truck.

The workers arrived from Asia and the Middle East, often on short-term contracts, to satisfy the Saudi government's ambitious development plans. But Iqbal stayed, raising three children and finding work over the decades, even as the Saudi government's priorities changed and its control over the foreign labor market tightened.

Recent shifts in government policy, however, have forced Iqbal to consider pulling up stakes, at the age of 60.

The government has imposed fees on the dependents of expatriate workers and restricted foreigners from working in certain sectors. Rising costs, as part of an overhaul of the economy intended to make Saudi Arabia less dependent on oil, have hit low-wage foreign workers especially hard. The result has been a massive exodus of foreigners from the labor force.

The abrupt outflow has also illustrated the steep challenges facing Crown Prince Mohammed bin Salman as he tries to remake the Saudi economy. A central pillar of his plan involves creating employment for Saudi citizens in the private sector, where jobs are overwhelmingly held by foreigners. In the short term, though, Saudi citizens have not filled the jobs that expatriates are vacating, adding to the pressure on business owners already struggling with an economic downturn.

Between early 2017 and the third quarter of last year, more than 1.1 million foreigners left the workforce in Saudi Arabia, according to the latest figures from the government statistics agency. It is not the first recent large-scale exodus of foreigners: Hundreds of thousands left or were deported in 2013 and 2017. But while that exodus was largely the result of a government crackdown on people violating a work visa sponsorship program, the latest flight appears to reflect broader hardships and unease, among foreigners and Saudi citizens alike.

The upheaval has added to a sense of uncertainty in the country as Saudi leaders grapple with a depressed economy, struggle to attract foreign investment and try to repair the kingdom's image after the killing of Washington Post contributing columnist Jamal Khashoggi by Saudi officials in Istanbul four months ago.

There are signs that the exodus has caught the government by surprise. Late last year, Saudi officials were reportedly considering lifting or easing the fees imposed on expatriate workers because of the harm the policy had caused the economy, according to Bloomberg News. But Saudi officials have yet to announce any change in the policy, and the fees remain in place.

In the long term, the flight of foreigners serves one of the government's most urgent priorities: finding jobs for the more than half of Saudis younger than 30 — and in doing so, staving off the kind of youth dissatisfaction that has led to protests in other Arab countries and unnerved the Saudi leadership.

But for now, a major concern has been a spike in the unemployment rate over the past two years, to as high as 12.9 percent. The growing jobless rate is forcing the government to revise its short-term unemployment goals and further exposing the gap between the expectations of Saudi workers and the jobs that are becoming available to them — in lower-wage construction or retail, for example — as the foreigners leave.

Karen Young, an expert on the political economy of the Persian Gulf states at the American Enterprise Institute, said that while it is good news that more Saudi women are entering the workforce, many with higher education degrees are not finding positions that match their skills.

The business environment in Saudi Arabia has also suffered because of the crown prince's more aggressive policies, including the arrests of hundreds of business executives, public officials and members of the royal family during what the government called an "anti-corruption" sweep last year. The crackdown spooked international investors, and local investors "complain of new hurdles to license and register businesses, and comply with new hiring policies" that require the hiring of Saudi citizens, Young said.

The government's response — to focus on "pump-priming," or increased government capital expenditures, was in line with what many economists would suggest to start growth when foreign investment and the local economy are sluggish, Young said. "But that is not a sustainable long-term growth strategy. The government cannot spend its way out of this forever."

In a sign that it was responding to the economic fears, the government this past week held its second major investor conference in less than four months, intended to draw hundreds of millions of dollars in investment for mining, energy and other industries. Also this past week, the Saudi leadership announced what it said was the conclusion of the anti-corruption purge, another major cause of investor anxiety.

The government has also promoted plans to expand the entertainment industry and tourism, betting that those initiatives will create jobs while also distracting from the criticism of the kingdom over its more repressive policies.

In the meantime, in immigrant neighborhoods, the exodus is immediately apparent. Buildings are emptying, stores staffed by foreign workers are struggling or shuttered, and nearly everyone knows families who have left or are strongly leaning toward heading home.

Those leaving or considering doing so include single men who spent a few years in Saudi Arabia, building up their savings or sending their earnings to family back home. And as the expatriates have embarked on an anxious search for work outside the kingdom, their home countries are bracing for the impact of a potentially dramatic decrease in remittance payments.

Christian Lacap, originally from the Philippines, has worked in the coastal Saudi city of Jiddah for the past seven years, but he said he decided to leave Saudi Arabia because of price hikes, which were imposed by the government as part of its economic program.

Saudi citizens, with better-paid government jobs, could absorb the rising costs. "But it's big for us," he said. "We have minimum salaries. It's too hard."

Lacap, who works in a restaurant, did not have a job lined up back in the Philippines and was hoping to go to another country — maybe South Korea or Canada — where the prospects were better, he said. He said he doubted whether a Saudi worker would take his job.

Others, such as Iqbal, said they are holding out for now.

He lost his last job, at a market research company that downsized as it struggled to pay the new government fees. Iqbal has been unable to find work since and fears his age has become as much a reason as the "Saudization" effort to replace foreign workers with nationals. The cost of utilities and basic goods has been rising, he said. Medicine is becoming more expensive for his wife, who is diabetic. Many of his friends have already left, so it is only a matter of time, he reckons, before he joins them.

"No one wants to live here. Everyone is going back to India," he said, adding that he had planned to work in Saudi Arabia for at least another five or six years. "I'm very sad, but what can I do?"

Salwan Georges in Jidda contributed.