The Gambia came back from two goals down to force a 2-2 draw with Congo in earthquake-devastated Morocco on Sunday and book their place at next year's Africa Cup of Nations finals.
Gambia needed only a draw while Congo had to win the Group G encounter which went ahead in Marrakech despite the powerful earthquake near the city which killed some 2,100 people.
- Stream on ESPN+: LaLiga, Bundesliga, more (U.S.)
The match was being played in Morocco because Gambia have been banned from hosting international matches by the Confederation of African Football (CAF) until they upgrade their stadiums and was in doubt after Friday's 6.8 magnitude quake, which forced both teams to evacuate their hotel rooms and sleep next to their respective hotel pools.
Coaches said the players had been traumatised by the effects of the powerful quake but were told by CAF to go ahead with the game, even though Morocco's scheduled qualifier on Saturday was postponed.
Congo scored first, when Gaius Makouta poked home from close range on the half-hour mark, and then had a fortuitous penalty converted by Silvere Ganvoula after Gambia captain Omar Colley was adjudged to have handled the ball. Television replays showed the ball had hit him on the shoulder blade but there was no VAR in operation for the match.
Gambia staged an unlikely comeback with teenager Yankuba Minteh getting a goal in the 79th minute and then Muhamed Badamossi scoring on the stroke of time to ensure Gambia finished second in the group, behind already-qualified Mali, and denied a crestfallen Congo a place at the finals.
It is the second successive qualification for one of Africa's smallest countries. At the last Cup of Nations finals in Cameroon, Gambia caused several upsets before being eliminated in the quarter-finals.
Their qualification means there are only two more places to be decided for the 24-team tournament in the Ivory Coast from Jan. 13-Feb. 11. Cameroon meet Burundi in Group C on Tuesday and the outcome of the match in Garoua will determine which two of Burundi, Cameroon and Namibia go to the finals.
Besides the Ivorian hosts, already qualified are Algeria, Angola, Burkina Faso, the Cape Verde Islands, the Democratic Republic of Congo, Egypt, Equatorial Guinea, Ghana, Guinea, Guinea Bissau, Mali, Mauritania, Morocco, Mozambique, Nigeria, Senegal, South Africa, Tanzania, Tunisia and Zambia.
Earlier on Sunday, Victor Osimhen scored a hat-trick as Nigeria competed their qualifying programme with a 6-0 home win over Sao Tome e Principe in Uyo. They had beaten the small island nation 10-0 away earlier in the campaign.
Togo came from two down to beat the Cape Verde Islands 3-2 in Lome with a double from Kevin Denkey.