There was plenty of drama on the last matchday of qualifying for next year's CAF Africa Cup of Nations as Liberia and Cape Verde Islands tripped at the last hurdle, while Togo came from nowhere to book their ticket to Gabon. The winner of the biennial event, which begins on 14 January, will qualify for the FIFA Confederations Cup Russia 2017 as African champions.

Highlights
Togo bound for Gabon

Going into their final game, Togo were third in Group A with eight points, two behind Liberia and 2004 champions Tunisia, who played against each other. Even Hawks coach Claude Le Roy, who has coached eight teams at the finals already, doubted his team's chances even if a win against Djibouti was a given. "I will not say forget about Gabon, but it will be complex. We can dream of a miracle, even though dreaming will make no difference.” But the Togolese made the dream a reality with a convincing 5-0 victory, which turned out to be enough to grab the final place as the second-best runner-up after Tunisia won the group with a 4-1 victory against luckless Liberia.

Tight wins for top two
Burkina Faso and Uganda went into the match even on 10 points and both ended their campaigns on 13 and in the finals after nervy victories. Burkina Faso did not have it all their way as the Stallions ended with nine men but scored a goal a full nine minutes into injury time to see off a strong Botswana challenge for a 2-1 win. The Cranes of Uganda qualified as the top-placed second place team after beating Comoros.

Congo DR keep rolling
Neeskens Kebano scored one of the goals for the in-form Congo DR as The Leopards ended Central African Republic's unlikely dream in Group B. Les Fauves needed a win in Kinshasa to qualify for their first-ever AFCON finals, but after Fulham's Kebano gave the home side the lead, there was no turning back and a 4-1 victory saw them comfortably win the group with 15 points.

High fliers keep altitude
Mali finished Group C with 16 points and a good helping of momentum after running out 5-2 winners against second-placed Benin. The other teams on 16 points – Morocco and Algeria – also won easily, beating Sao Tome e Principe and Lesotho respectively. Senegal were the only nation to win six out of six in the group stage after completing the perfect run with a victory over Namibia in Dakar.

Upsets
Cape Verde lose at home

Although they could no longer win Group F, Cape Verde Islands knew that a win in their final match against Libya at home would almost certainly see them in Gabon next year as one of the best runners-up. But although the Blue Sharks dominated the match, they failed to convert their chances and were made to pay late in the game as Fouad Triki Mohamed found the winner for the North Africans.

Disappointing draws
Champions in 1996, South Africa ended their Group M campaign as it started: with disappointment. Bafana Bafana drew their opener at home to bottom side Gambia and over the weekend missed a penalty en route to a 1-1 draw at home against Mauritania, leaving them with just one victory out of six and no wins at home in three. Ghana also could only draw at home by the same score against Rwanda in Group H, which they had already won.

Player of the weekend
The last time Uganda were able to parade their skills on Africa's greatest footballing stage was in 1978, when they were beaten in the final by Ghana. They have come close to qualifying since but always failed to clear the last hurdle. They finally managed to end their 44-year wait through rising teenage star Farouk Miya's first-half goal. The talented 18-year-old forward is based in Belgium with Standard Liege.

The number
6
–The number of former AFCON champions that will not be at the finals next year after falling short in the qualifying campaign (Nigeria, Zambia, Sudan, Ethiopia, South Africa, Congo).

What they said
"We are a new team and just getting to know each other, but I know my players have the quality to play good football. We played against Tanzania who put many players behind the ball. We needed time to break them down, but our quality is not in doubt," new Nigeria coach Gernot Rohr, whose side beat Tanzania 1-0, but had already been eliminated in Group G by Egypt. Rohr was turning the eyes of the nation's frustrated supporters to Nigeria's opening 2018 FIFA World Cup™ group stage qualifier against Zambia next month

Teams qualified for Gabon, 2017: Tunisia, Togo, Congo DR, Mali, Burkina Faso, Uganda, Guinea-Bissau, Morocco, Egypt, Ghana, Côte d'Ivoire, Algeria, Senegal, Zimbabwe, Cameroon, Gabon (hosts)

Have your say
Which nation is the favourite to win the Cup of Nations and go to Russia 2017?