Since the end of apartheid in South Africa in 1994, South Africa and Nigeria have never had an easy relationship. Over the years, as different presidents have come and gone, the two countries have often been at loggerheads for different reasons.
But this was predated by Nigeria's strong solidarity with black people when South Africa was still under apartheid rule. After obtaining independence from Britain on 1 October 1960, Nigeria mounted pressure on the apartheid regime to stop oppressing the black majority. The Nigerian government even went as far as imposing a special tax to raise funds for the liberation cause.
In the intervening decades, and after the end of apartheid, the relationship has seen some rough patches. The most fraught was between 1983 and 1998 - the second period of military rule in Nigeria.
During this period Mandela became president in South Africa and took a tough stance on human rights. The relationship hit a new low in November 1995 when Mandela criticised the planned hanging of playwright Ken-Saro-Wiwa, by the military regime led by General Sani Abacha.
Relations improved after Nigeria's return to democracy in 1999. But underlying tensions have always remained. The most recent trigger was the September 2019 attacks by South Africans against other Africans - including Nigerians. There were similar outbreaks of violence in 2008 and 2015.
A number of African countries have been affected by the periodic attacks on immigrants. But Nigeria has taken a particularly strong stance. The backlash back home was sufficiently vociferous that President Muhammadu Buhari was forced to visit South Africa to revive cordial diplomatic relations between the two countries.
The summit between Presidents Cyril Ramaphosa and Buhari was cordial. In the main, it focused on how the two countries should strengthen their economic, political and social relations under the banner of the bi-national commission, as opposed to focusing primarily on the attacks.
Following this meeting, and after envoys from both countries held diplomatic talks, relations between the two countries are now back to normal.
The Mandela era: 1994-1999
When Mandela became the first democratically elected President of South Africa he indicated early on that the country's post-apartheid foreign policy would be based on human rights protection.
Mandela's stance didn't augur well for future relations with Nigeria. The country was going through a turbulent time following the decision by General Sani Abacha to annul the outcome of the 1993 presidential elections which, by all accounts, had been won by Chief Moshood Abiola. Abacha ordered Abiola's arrest.
Relations deteriorated even further after Abacha ordered the arrest of activists from Ogoniland in Eastern Nigeria. Ken Saro Wiwa, who had been instrumental in the formation of the Movement for the Survival of the Ogoni People, became Abacha's primary target. Abacha had him arrested with eight others. All nine were tried and sentenced to death.
Despite global calls for their lives to be spared, Abacha had them executed. Mandela persuaded the Commonwealth and the then Organisation of African Unity to ostracise Nigeria. He also called on the international community to boycott Nigerian oil.
Apart from Namibia's Sam Nujoma and Zimbabwe's Robert Mugabe, not all African leaders agreed with Mandela's approach to the Nigerian crisis. South Africa was a newcomer in democracy, and Mandela was accused of turning against his own.
Armed with this division in the Commonwealth, Abacha gained confidence to continue unabashedly with his human rights abuses. This worsened relations between the two countries.
The end of military rule in Nigeria in 1998 opened a new chapter.
The Mbeki era: 1999-2008
In 1999, new people took over as heads of state in both countries.
The return to civilian rule in Nigeria augured well for relations between the two countries. In addition, the two leaders had known each other since the apartheid years. Both men prioritised an African agenda. Thanks to this common purpose, bilateral relations between Nigeria and South Africa improved significantly.
It was during this time that a bi-national commission was established. The aim was to work together on economic and political issues, including trade relations.
The idea was that, as the economic powerhouses on the continent, the two countries could work together for the betterment of Africa.
The Zuma era: 2009-2018
In May 2007, President Umaru Yar'adua took over from Obasanjo. He was less known by the world, including South Africa. He was also unwell, and died in office in 2010. President Goodluck Jonathan took over as president.
There were changes in South Africa too during this period. In 2009, President Jacob Zuma took over as head of state.
Relations between South Africa and Nigeria in the Zuma/Jonathan era were lukewarm. In 2012, South Africa's decision to deny 125 Nigerians entry at Oliver Tambo International Airport in Johannesburg triggered a diplomatic standoff between the two countries. The Nigerians were denied entry because they had invalid yellow fever certificates.
In retaliation, Nigeria deported 56 South African businessmen from Lagos.
In 2013, Jonathan paid a state visit to South Africa. The two presidents agreed to revive their bi-national commission meetings, and to upgrade them to include other heads of state.
The way forward
After Ramaphosa took over as head of state in February 2018 the hope was that relations between South Africa and Nigeria would improve.
The recent attacks on foreigners threatened to throw that off course. Buhari's state visit was an attempt to sit down with Ramaphosa and discuss how a similar occurrence could be avoided in future.
Going forward, the two countries must desist from perceiving each other as competitors if they want to forge a fruitful and peaceful relationship. They need to work together for the betterment of the continent. Nigeria is a major player in West Africa while South Africa is a major player in the Southern African Development Community region. Sustained tensions would be to the detriment of both countries - and Africa as a whole.
Author: Bheki Mngomezulu - Professor of Political Science, University of the Western Cape