For months, anti-migrant rhetoric had been building across South Africa. Then it reached Kaunga Nyirenda's doorstep.

In early June, two men gave the Malawian gardener, who lives in a Johannesburg suburb, a chilling ultimatum: leave now or face death. "They asked me: 'When are you going to leave the country? We want to fix our country. If you don't leave now, you're going to leave in a coffin because we don't need anyone after 30th of June,'" he said.

Nyirenda's experience reflects a broader surge in anti-immigrant sentiment. In recent weeks, protest groups and self-styled vigilantes have staged demonstrations that have appeared to spark violent attacks on both documented and undocumented foreign nationals.

The South African government has rejected the so-called "deadline" made by the groups for foreigners to leave the country, as fears grow of a violent climax at the end of the month.

One of the groups, March & March, called for mass protests on Tuesday if its demands, including the "immediate and massive deportation of all illegal foreigners currently in the country," are not met.

Ahead of the planned demonstrations, South African President Cyril Ramaphosa warned that the government "will not tolerate any attempts to destabilize the country by anyone, whether marching or otherwise."

He has repeatedly condemned attacks on foreign nationals, saying they "do not represent the views of South Africa's people, nor reflect our government's policy." He blamed the violence on "opportunists who are exploiting the legitimate grievances, particularly those of the poor."

As tensions escalate, police in South Africa have opened investigations into the recent murders of several foreign nationals. Two Mozambican men were killed during violence in late May in Mossel Bay, where more than 50 shacks in an informal settlement were burned.

Authorities are also investigating the death of a Malawian man after he was allegedly killed by a mob at an informal settlement in Pietermaritzburg. The attack forced hundreds of migrants to seek shelter in churches and mosques.

With the end of the month fast approaching, the migrant exodus has continued as fear of further mob attacks spreads through poor neighborhoods and informal settlements.

Additional reporting by Nimi Princewill and Latief Dayan, CNN.