Nigeria and South Africa: When two African giants meet
The leaders of Africa's two superpowers, Nigeria and South Africa, have met in the wake of recent xenophobic attacks in Johannesburg in which Nigerians were targeted.
South Africa's President Cyril Ramaphosa welcomed his counterpart, Muhammadu Buhari, to Pretoria and the two men will hope to put the tension behind them and focus on economic cooperation.
Our correspondents in Lagos and Johannesburg look at how the two nations view each other.
Rivals and partners
Mayeni Jones, BBC News, Lagos
It's fair to say that there's long been a rivalry between Nigeria and South Africa. Many Nigerians see South Africa as their only other competitor on the continent for sporting prowess, cultural output and economic strength.
They're Africa's two biggest economies, taking it in turns as the top economic performer. Culturally, Nigeria's popular Afrobeats music has been a global force for years now, and its artists are some of the most famous African musicians in the world.
The country has Africa's fastest growing music industry and is projected to be worth $86m (£70m) in 2020. Nevertheless South Africa's music industry is larger still, with a projected growth of $178 million by the same year.
And all you have to do is sit with fans on either side of the aisle during a football match between national teams the Super Eagles and Bafana Bafana to feel how deep the competitive spirit between these two African giants runs.
Historically, Nigeria played a key part in providing diplomatic support to the anti-apartheid movement.
And since both countries' transition to democracy, they've been economic allies. Some of the biggest companies operating in Nigeria - including the mobile network MTN, the supermarket chain Shoprite and the broadcaster MultiChoice - are all South African.
South Africa v Nigeria GDP
But despite considering them worthy competitors, many Nigerians also express disdain for what they see as a sense of entitlement from South Africans.
Previous xenophobic attacks in South Africa in 2008 and 2015 that targeted poor African migrants in the country's townships had many Nigerians feeling that South Africans were directing their anger at the wrong people.
This was expressed on the streets of Lagos and online during last month's wave of attacks in Johannesburg and other cities.
Nigerians took to social media and call-in radio shows to express their anger that once more, other Africans were being targeted for trying to make a living in South Africa. TV shows on Nigeria's satellite channels had one commentator after another condemning the violence.
If South Africans worked harder, was their reasoning, then their African peers would not be making more money from them. And anyway, shouldn't they be angry at the white South Africans dominating their economy?
This anger spilled out onto the streets of Nigeria's urban centres. Young people, allegedly motivated by a need for revenge, and fuelled by fake videos and photos on social media, started looting and burning South African businesses.
Both governments were too slow in clarifying that no Nigerian lives were lost in the violence. They underestimated the anger online propaganda can whip up.
South Africa v Nigeria GDP per capita
But some analysts believe Nigeria's growing unemployment rate, which has tripled in the last five years, may have also played a part. Joblessness is worse amongst the country's young and many of the looters also targeted Nigerian businesses, suggesting their motives may not have been entirely to do with xenophobia in South Africa.
And in that respect, both Nigeria and South Africa have a lot in common: they've seen their economic growth rate slow in recent years, leading to disenchantment with the ruling parties. Frustration with the status quo has sparked outbursts of violence that have surprised the authorities.
For that reason Presidents Ramaposa and Buhari need to put the issue of xenophobia to rest, and return to finding ways of collaborating to nurse their underperforming economies back to health.
Our love-hate relationship
Milton Nkosi, BBC News, Johannesburg
South Africans view Nigerians as their sibling rivals.
There is a love-hate relationship which dates back decades. Both believe they have a significant place in African history and both are proud to be economic giants of Africa.
Many Nigerians came to South Africa at the advent of democracy in 1994 after the end of apartheid. But there has been a change and Nigerians feel betrayed by how some South Africans treat and portray them.
There are many negative stereotypes here and Nigerians are often depicted as drug lords, human traffickers and online scammers. Despite a general uptick in crime, South Africans are quick to blame foreigners for the problems in the country.
Another problem is the rise in charismatic churches - some led by Nigerian pastors - where the theology and doctrines have been questioned.
The televised trial of Nigerian evangelist Timothy Omotoso, who is accused of sexually assaulting congregants, has gripped people here and added to the anti-foreigner sentiment. Mr Omotoso denies the charges.
There is also competition in the job market, and not just at the level of unskilled workers.
In the corporate world, Nigerians turn up with qualifications from the top Western universities, such as Harvard, Yale, Oxford and Cambridge. Some South Africans seem to resent the presence of foreigners in the best-paid jobs. They deem it as unfair competition because while they have graduated from well-run local universities, their status is dwarfed by the global giants.
In anger, some suggest that educated Nigerians could be making positive contributions back at home where there is clearly a need, instead of going abroad and taking the top jobs from the hands of qualified South Africans.
South Africa v Nigeria populations
But on a government-to-government level the relationship seems more cordial. Earlier this month, President Buhari thanked South African envoy Jeff Radebe for visiting Nigeria to apologise for the recent violence saying "pledging that the relationship between the two countries will be solidified".
This is despite some hiccups such as the hefty $5bn fine levied against South African telecoms giant MTN by Nigeria in 2016, which was later reduced after negotiations.
Officials here, particularly members of the governing African National Congress, appreciate the support that Nigeria gave during the anti-apartheid struggle.
Many prominent leaders were in exile fleeing from the racist white minority regime. Some of them, including former President Thabo Mbeki, spent time in Nigeria and therefore find it hugely difficult when locals attack fellow Africans. They feel embarrassed by what is sometimes described as Afrophobia.
As President Ramaphosa told me in an impromptu interview last month we should be "ashamed".
South Africa attacks
|Xenophobic violence incidents by Province, 1994-2018|