Egypt have claimed the final automatic African qualifying place for the London 2012 Olympic Games.
They beat Senegal 2-0 in the third place play-off match at the African U23 championship to take their spot.
Goals from Mohamed Abdel-Baset and Saleh Gomaa gave them the win in Marrakesh.
Senegal created chances but were not able to convert any of them - and must now face a play-off against an Asian team for the remaining Olympic place.
"2011 was a difficult year for Egypt but we end it with a smile," coach Hany Ramzy told the BBC.
"I would like to thank all 21 players who were here with us and I send my best wishes to all Egyptian people."
Egypt's senior team failed to qualify for the 2012 Africa Cup of Nations but Ramzy says that making it to London more than compensates for that.
"Everybody was sad when we didn't qualify for the African Cup but London is much bigger than the African Cup so everbody is happy," the coach said.
The match, played in a mostly empty stadium ahead of the final of the tournament later on Saturday, was a scrappy affair with neither team really asserting their authority.
Egypt keeper Ahmed El Shenawi was forced into action on a number of occasions and was equal to the task, tipping over a shot from the Senegal captain and making a number of saves.
But his opposite number Demba Camara was at fault for the opening Egyptian goal, as he fumbled Abdel-Baset's shot, allowing the striker a second chance, which he took just after the half-hour mark.
The second goal came with around 25 minutes to play, as Gomaa cut in from the left and fired home a low, powerful shot.
Despite late pressure from Senegal, Egypt's win was never really in doubt after that, and the team who had to give up home advantage because of the political situation in their country have nonetheless booked their place at the Olympic Games.