Although Nigeria and SA are often cast as rivals, they have a strong bilateral relationship founded over the decades. This springs in part from Nigeria's historical role in its support for the liberation struggle against apartheid, writes Olayinka Ajala.There were mixed feelings among Nigerians over President Muhammadu Buhari's state visit to SA because of the recent xenophobic attacks in the country. While many Nigerians disapproved of the visit, Buhari's government insisted that it was imperative to go ahead. Their argument was that it was vital for the two countries to continue working together.The recent attacks sparked angry reactions in Nigeria. Some Nigerians called for severing relations with SA or imposing additional taxes on South African companies in Nigeria. They claimed these actions would serve as an ample response to the xenophobia and also send a signal to SA that xenophobia is unacceptable. But others argued that there was a need to mend the relationship so that the two countries could prevent further chaos. Buhari heeded these calls, clearly choosing to tread the path of reconciliation when he visited SA. His visit is important for three main reasons. First, to protect the close economic ties between the countries, second, the Nigerian government wants to be seen as proactively protecting its citizens abroad and lastly because the South African government had to do something to mend fences with its important ally.The driversOne of the main drivers behind Ramaphosa's invitation, and Buhari's visit, was the need to ease tensions between the two largest economies in Africa.There are deep economic ties both ways. Over 120 South African companies operate in Nigeria, ranging from mobile operators to retailers. SA, on the other hand, is a significant buyer of Nigerian oil. There are also a significant number of Nigerian businesspeople, professionals and other migrants in SA.Any further escalation would not only hurt the relationship but also threaten the economies of both countries. Second, the Nigerian government has been previously accused by the Nigeria Union SA (NUSA) of not protecting its own citizens abroad. The visit could therefore be seen in context of addressing the displeasure of Nigerians at home and also to assure those living in SA that the government takes their welfare seriously. For his part Ramaphosa certainly made all the right noises. He reiterated SA's "deep regret" over the violence and assured Nigerians living in the country of adequate protection.Third, the visit could also help SA address tensions with other aggrieved African countries. These include Rwanda, Malawi and Democratic Republic of Congo. All have threatened to cut ties with SA over the attacks.Bilateral tiesAlthough Nigeria and SA are often cast as rivals, they have a strong bilateral relationship founded over the decades. This springs in part from Nigeria's historical role in its support for the liberation struggle against apartheid. Nigeria provided support, as well as financial backing for the African National Congress (ANC) during its campaign against the apartheid regime.For instance, after the Sharpeville massacre in 1960, Nigeria led calls for sanctions against the apartheid regime. Under the auspices of the Organisation of African Unity, now the African Union, it championed the imposition of a trade embargo on the regime.But relations haven't always been cordial. For example, after the end of apartheid rule in 1994, South Africa put pressure on the international community to support the protests against military rule in Nigeria especially after the execution of Ogoni activists. This enraged the ruling military government. Nigeria returned to democracy in 1999. This laid the ground for a renewal of cordial relations which resulted in several bilateral arrangements. For example, in October 1999, a SA-Nigeria Bi-National Commission was established. Several bilateral agreements on trade and investment followed.The first major international partnership was in 2000, when president Olusegun Obasanjo of Nigeria and Thabo Mbeki of SA both attended the G8 meeting of the world's richest states to argue for debt forgiveness for African countries. Both leaders also played a significant role in the creation of the New Partnership for African Development (Nepad).What still needs to be doneBuhari's visit has already been judged successful by government officials and media outlets in Nigeria.But there are practical issues that must be addressed by both countries. For the South African leader, there is need to act on attenuating the rhetoric that foreigners are responsible for the social ills in the country. For instance, the Mayor of Johannesburg, Herman Mashaba, has been accused of making "reckless" remarks against migrants which "may incite more xenophobic violence".For his part, Buhari needs to provide assurances of protection to South African businesses in Nigeria. He needs to reassure them that Nigeria will continue to protect them and their investments. Both leaders also need to work together to reduce poverty, corruption and unemployment in their countries. These are some of the key issues stoking attacks and counter-attacks in both countries.Although Nigeria and SA are the two largest economies on the continent, both face huge problems. When it comes to the human development index Nigeria ranked 157 last year and SA 113 out of 189. On corruption, SA was ranked 73 and Nigeria 144 out of 180 countries surveyed last year. The ability of both to work together to address the issues holding back their development would go along way in determining their future together.- Olayinka Ajala, Associate Lecturer and Conflict Analyst, University of York.This article is republished from The Conversation under a Creative Commons license. Read the original article.