Illegal migration is a problem everywhere. All over the world, people move from weaker economies to stronger economies in an attempt to make a living/support their families/find their 'better life'. South Africa has experienced a ramp up in recent years of African migrants. This is related to - but obviously not an excuse for - the xenophobic attacks that have happened in South Africa's poorest communities, flaring up sporadically as locals feel the pressure of poor economic circumstances and vent their frustration on the foreigners who they see as stealing their jobs/opportunities.
Increasingly, however, it appears that South Africa's economy is, for some unknown reason, attracting illegal workers from further afield. The country last week deported 400 illegal Asian immigrants to Mozambique, from where they allegedly entered South Africa. This move has highlighted a particular problem for Mozambiquan authorities, who, on a weekly basis, stop immigrants from all over the world who are bound for South Africa. This is a problem for South Africa - it's one thing to be accommodating illegal economic migrants from the rest of Africa, but an economy that has 40% unemployment of its own people really can't be supporting the rest of the world as well. It is also a problem for Mozambique. The country has limited security resources and would probably prefer not to have to expend them all working to protect the border with South Africa, a very small part of the country's very long border. They are somewhat dependent on South Africa, however, economically and would probably like to stay in the larger country's good graces, so they will redirect resources to this anyway.
Immigration is always a complicated problem. South Africa has proved to be very bad at keeping illegal immigrants out and seems ambivalent even about actual policy on this issue, especially towards other Africans. The situation is unlikely improve if an ever-increasing number of illegal immigrants (especially those from outside of the continent) keep flooding over the border from Mozambique. How do you solve an illegal immigration problem without vilifying immigrants and encouraging xenophobia even further?