Uganda scored their first goal at the African Nations Cup since 1978 as a 1-1 Group D draw with Mali in Oyem ensured both teams were eliminated.
Only Mali had retained any chance of progressing to the Gabon-held competition's quarter-finals but they required three points and for Egypt to lose to Ghana in the group's other fixture.
Egypt, however, won 1-0, overtaking Ghana to ensure they finished first and their opponents second. Mali had to come from behind against Uganda to secure a second draw from three and finish third in the four-team pool.
Farouk Miya gave Uganda the lead in the 70th minute. Receiving possession in space on the edge of the area, he powerfully struck beyond Mali goalkeeper Oumar Sissoko and inside the far left post.
Miya scored the goal last September that secured Uganda's qualification for their first African Nations Cup appearance for 39 years, and his strike secured a small piece of history for his country. Phillip Omondi had been their last scorer, against Nigeria in the 1978 semi-finals.
Three minutes after Miya struck, Uganda were pegged back by Mali.
Mali were awarded a free-kick on the edge of the area when Moussa Marega was fouled by Murshid Juuko. From it, Yves Bissouma produced an impressive and powerful finish, into the top-left corner, out of goalkeeper Robert Odongkara's reach.
Mali had previously drawn with seven-time champions Egypt and lost to Ghana, while Uganda had lost to both teams.