With increasing pressure to create jobs for Saudis, the government has been clearing out the excess workforce comprised of millions of foreigners.

An Asian worker walks past an image of Saudi King Salman in Riyadh, Saudi Arabia, Tuesday, April 19, 2016.

For four months, texts from the government pinged into every mobile phone in Saudi Arabia ordering "illegal expatriates" to leave the kingdom before the end of an amnesty that expired in late July.

The campaign, "A nation without violators," warned of fines, jail time and deportation for anyone caught without valid identity documents after the grace period, in a renewed push to reduce the kingdom's abundant black market in labour.

Saudi authorities estimate more than 600,000 people took the amnesty, which allowed any foreigner in breach of residency laws in the world's top oil exporter to leave without penalty.

But millions of others have remained, either determined to stay or unable to avail themselves of the offer. Now they are awaiting a pledged crackdown against what Riyadh calls the "reckless people" who defied the order to leave.

"We don't know what will happen to us," said Atif Alam, 28, an Indian worker at a desolate labour camp in eastern Riyadh who fears a police raid. He rarely leaves the camp, wary of being seized at police checkpoints on roads throughout Riyadh.

Labour black market

Some 12 million of the 32 million people living in Saudi Arabia are foreigners, according to official figures, most of them low-skilled workers from Asia and Africa working in the construction and service sectors.

But several million others live here outside the law, running unregistered businesses or accepting informal work with companies skirting requirements to hire Saudis on higher pay.

Authorities have not released population estimates for "violators," but before the start of the amnesty, a member of the advisory Shura Council called for the deportation of five million people, according to Al Hayat newspaper.

Some entered the country illegally, risking a dangerous journey through Somalia and Yemen, while others overstayed work visas, ran into labour disputes with their employers or came to perform the annual Muslim hajj pilgrimage and never went home.

Saudi authorities tolerated labour irregularities for decades, due to the expense and economic impact of expulsions.

But with greater pressure in the past decade to create jobs for Saudis, for whom the unemployment rate is 12.7 percent, the government has committed to clearing out the excess workforce.

The kingdom offered a first-grace period back in 2013, after introducing a quota system for hiring Saudis in the private sector. At least 800,000 people were deported in the crackdown that followed, according to figures compiled from local media.

In some cases that campaign turned violent, with unrest in urban areas and detention centres. Pressure for economic reform has only grown after the oil price halved since 2014.

Slipping through the cracks

Authorities appear to have run a more organised amnesty this time, although they did not respond to requests for comment on the planned clampdown. Workers in Riyadh report individual arrests, but no mass raids or expulsions so far.

Still, thousands of workers have slipped through the amnesty's cracks. They were refused exits, many of them apparent victims of slow-moving bureaucracy, complex legal problems, or both.

Wilma, 43, a Filipina beautician who gave only her first name, applied for the amnesty and was rejected because of an unresolved wage dispute case against her former employer.

She won the case two years ago, but never received her passport or missing six months of wages. In the interim, her residency expired.

She found a job off the books in another salon last year, which helped pay for the bed she rents in an apartment with other workers from the Philippines in central Riyadh.

But she quit as the grace period ended, wary of being caught working without valid identity documents.

"The premise of this amnesty is that the irregular status of the worker is his or her own fault," said Vani Saraswathi of Migrant Rights, a Gulf-based advocacy organisation. "In reality most workers have no power over their visa status."

"There is likely to be a crackdown, but for most workers it's a risk worth taking."