Tanzania upset Guinea to reach the 2025 Africa Cup of Nations before Botswana and Mozambique became the last two teams to qualify for next year’s tournament.
Guinea had needed to avoid defeat in their trip to Dar Es Salaam to finish second in Group H, while the East Africans knew victory would book a place in Morocco.
Mady Camara rattled the Tanzania bar before the break and the Taifa Stars eventually ran out 1-0 winners after Simon Msuva headed in from just inside the six-yard box in the 61st minute.
Tanzania, who will co-host the 2027 Afcon alongside Kenya and Uganda, are ranked 34 places below Guinea in the world.
Meanwhile, Botswana will feature at the finals for just the second time after picking up the point they needed away against Egypt to finish second in Group C.
Omaatla Kebatho gave the Zebras an early lead in Cairo after sloppy defending from the hosts, but Trezeguet quickly equalised for the Pharaohs.
Botswana held on to draw 1-1 and finish a point above Mauritania, who rounded off their campaign with a 1-0 home victory over 10-man Cape Verde.
The southern Africans, who were the lowest seeds in their group, lost all three group games on their sole previous Afcon finals outing in 2012.
Similar to Guinea, Mozambique knew a point from their trip to Guinea-Bissau would be enough to progress from Group I, while the West Africans needed all three points.
The visitors went ahead in the ninth minute through Bruno Langa, but Everton striker Beto levelled three minutes before half-time.
Stanley Ratifo restored the advantage for the Mambas in the 52nd minute, and Mozambique closed out the game to secure back-to-back qualifications.
Africa’s biggest sporting event will begin on 21 December next year and run until 18 January 2026.
The Confederation of African Football is yet to announce the date of the group draw for the finals.
Afcon 2025 qualified teams
Morocco (hosts), Algeria, Angola, Benin, Botswana, Burkina Faso, Cameroon, Comoros, DR Congo, Egypt, Equatorial Guinea, Gabon, Ivory Coast, Nigeria, Mali, Mozambique, Senegal, South Africa, Sudan, Tanzania, Tunisia, Uganda, Zambia, Zimbabwe