South Africa will host the 2013 Africa Cup of Nations in place of Libya, the Confederation of African Football (Caf) has announced.
Libya gave up the right to host the event because of the continuing upheaval in the country.
They will instead organise the 2017 tournament, which had been due to take place in South Africa.
The swap is confirmation of a deal between the two countries which was revealed some weeks ago.
At the time Caf said that the announcement was premature, with Nigeria and Algeria also expressing an interest in stepping in.
Nigeria had been named as standby hosts when Caf made their original announcements about the venues for the tournaments from 2010 - 2014.
But the decision to go with South Africa was ratified at Caf's Executive Committee meeting which is taking place in Cairo.
South Africa will also replace Libya as hosts of the 2014 African Nations Championship, the tournament for locally-based players.
Earlier this year they organised the African U20 championship, which was also given-up by Libya.
Caf also announced the hosts of a number of other major events.
Namibia will organise the 2014 Africa Women's Championship and Niger will take on the 2015 U17 tournament.
Senegal will host the 2015 U20 finals while Madagascar will stage the U17 championship in 2017.