Morocco will face Congo, Zambia and Tanzania in the group stage of the African Cup early next year.
Title holder Senegal will play in the group against Cameroon, Guinea and Gambia in Ivory Coast. The draw was made in Abidjan, the largest city in Ivory Coast.
A total of 24 countries are participating, spread over six groups. Host country Ivory Coast leads group A and will face Nigeria, among others.
Morocco reached the quarter-finals during the previous Africa Cup. In the last eight, Egypt was too strong 2-1 after extra time. Egypt later lost to Senegal in the final on penalties.
The African Cup of Nations will be held from January 13 to February 11. The tournament was moved by six months. The months of June and July are the height of the rainy season in Ivory Coast.