The answer is both the 2006 and 2010 Africa Cup of Nations. In 2006, Egypt lost to Ivory Coast on penalties in the final, while in 2010, Egypt was crowned champions after defeating Ghana in the final.
The Wondrous World of Carlos Queiroz: A Football Manager Extraordinaire