Thousands of South Africans are marking Freedom Day while the country is still marred by widespread anti-foreigner attacks that have killed at least seven people.

Freedom Day commemorates the election of 1994, which established universal suffrage for all races for the first time. Previously, non-white people had limited voting rights in the apartheid regime.

"This Freedom Day takes place during a difficult time when our nation is reeling from the violent actions of a minority that resulted in the people of our country being wrongfully labelled as xenophobic and hostile and intolerant of our brothers and citizens from the rest of the African continent," the African National Congress said, according to a report by the Independent Online.

"We mark this Freedom Day therefore deeply aggrieved by these acts of violence and in mourning for the lives of the seven people [three South Africans and four non-South Africans] that have been lost during this period."

It is believed that the violence erupted in Durban, and later spread to Johannesburg, following alleged comments by Zulu King Goodwill Zwelithini, who said that foreigners need to "pack their bags and leave".

Following the remark – which Zwelithini denied making – several South Africans took to the streets of Durban and attacked and looted foreign-owned shops and properties. The protesters accused foreign nationals of living in South Africa illegally and stealing jobs and opportunities.

After days of unrest, which prompted thousands to flee their homes and find shelter in makeshift camps, South Africa deployed its army to help police halt the violence. The deployment followed the fatal stabbing of immigrant Emmanuel Sithole. Pictures of him pleading for his life before being killed were published by local newspapers, provoking anger.

Countries such as Nigeria and Malawi said they would repatriate their citizens and South Africa condemned the "unfortunate and regrettable" decision of Nigeria to recall its envoy.

South Africa's Department of International Relations and Co-operation said in a statement that the country was "decisive and unequivocal in condemning and rejecting the attacks on foreign nationals" and that "through our interventions, relative calm and order has been restored".

The statement also said that the nation does not blame Nigeria "for the deaths and more than nine months delay in the repatriation of the bodies of our fallen compatriots" during attacks by Nigerian terror group Boko Haram.