The draw for the Africa Cup of the Nations was lit up by a dazzling fireworks over the Pyramids of Giza on Friday.
Egypt, which is hosting this year's tournament, will face DR Congo, Uganda and Zimbabwe in Group A.
Defending champions Cameroon were drawn in Group F along with Ghana, Benin and Guinea-Bissau.
Moroccan manager Herve Renard said the tournament favourites were Egypt, followed by Morocco.
Renard's side will play Ivory Coast, South Africa and Namibia in Group D.
This year's tournament is the biggest Africa Cup ever to be held, with 24 teams competing from June 21 to July 19.