Mali beat Egypt 1-0 in the 2015 Under-23 African Cup of Nations to end the Pharaohs' hopes of reaching the the Olympic Games in Rio de Janeiro, Brazil, next year.
The Eagles were already knocked out of the tournament heading to the Stade Caroline Faye in M'Bour on Saturday, but dragged the North Africans out with them.
Egypt had to beat Mali to stand any chance of escaping a competitive Group B, but fell a goal behind after 19 minutes.
The West Africans took the lead in rather lucky circumstances. Souleymane Coulibaly saw his header at goal from a corner-kick loop over the Egyptian goalkeeper by a disorientated Mahmoud Attia.
Mali should've doubled their lead three minutes later after Adama Niane put it on a plate for Souleymane Sissoko, but the forward could only succeed in blazing his shot over the crossbar.
Egypt upped the ante following the break and after Mamdouh Elsayed forced Djigui Diarra into a fine save on 58 minutes, Karim Hassan saw his header attempt from close range fly wide a few seconds later.
Mali should have put the game beyond doubt with nine minutes of regulation time remaining, but Adam Traore was unable to capitalize on an horrendous mistake by the retreating Mohamed Sharf Edin.
In the end Coulibaly's deflected effort proved to be enough for Mali who head home alongside Egypt who will not be extending their record of 11 previous appearances at the Olympic Games.
Algeria face South Africa while hosts Senegal lock horns with perennial powerhouse Nigeria for a place in the final.