Fans who had filled the 45,000-capacity Namboole Stadium could not contain their joy at the final whistle, launching a full-blown pitch invasion to begin the celebrations, which erupted simultaneously across the country after the 1-0 victory against Comoros.
With one of the youngest populations in the world, with an average age of 15, most Ugandans had not even been born the last time their country appeared in the tournament finals.
The Ugandan team, under their nickname The Cranes, has been trending on social media across the country, with politicians also keen to show their support.
Uganda’s Minister for Education and Sports Janet Museveni, who is also the first lady, saw a divine hand – if not “The Hand of God” – behind the historic win:
And what of the legends of the 1978 campaign, who made it all the way to the final only to suffer a 2-0 defeat to hosts Ghana?
Only four of the players involved in that campaign are still alive, a shocking statistic, perhaps partly explained by the fact that the life expectancy at the time they were playing was just 49 years.
Defender Tom Lwanga, now 56, is one of the survivors of the team from 1978. He has kept his official accreditation as a memento of that fairytale tournament.
He told the BBC that he was delighted at the team’s qualification and impressed that they were able to carry the burden of nearly four decades of disappointment.
Minnows on the march
Apart from Uganda’s historic win, the biggest surprise on the road to Afcon 2017 came from Guinea-Bissau, who defied all expectations in their qualifying campaign.
The team from the Portuguese-speaking West African nation, who have never made it the tournament finals, topped a “group of death” in qualifying, which included former African champions Zambia and Congo-Brazzaville, as well as Kenya.
Continental giants Nigeria, champions in 2013, failed to qualify for their second successive Nations Cup.
That was despite the Super Eagles having a population about 100 times larger than Guinea-Bissau and Gabon, the two smallest nations who booked places for Afcon 2017.
Nigerian fans may now be looking enviously in Gabon’s direction, wishing they had bid for the tournament. The Panthers gained automatic qualification for Afcon 2017 by virtue of being the hosts.
For fans of Cape Verde, protagonists in one of the most unlikely stories in African footballing history, there was no happy ending this time.
The tiny island nation, with a population of 500,000 and named the top team in Africa in March, according to Fifa’s global rankings, did not manage to qualify for Gabon in 2017, despite their remarkable achievement.
Who will be next?
And if you felt bad for Ugandan fans waiting nearly four decades between tournaments, consider the 15 countries who have still never made it to the tournament finals:
- Central Africa Republic
- The Gambia
- Sao Tome
- South Sudan
So which of them has the best chance of breaking their duck and making it to Afcon 2019 in Cameroon?
Mauritania might be a good bet. The largely-desert country can normally be found rooted to the bottom of an Afcon qualifying table.
But this time they finished runners-up to Cameroon, breaking into the top 100 of the Fifa world rankings for the first time in 20 years.