African football supremos made the draw on Thursday night for the delayed 2023 Africa Cup of Nations during a glittering gala ceremony in Abidjan.
Hosts Cote d'Ivoire will kick off the competition on 13 January 2024 against Guinea-Bissau at the Alassane Ouattara Stadium in Abidjan.
They will also play Equatorial Guinea and Nigeria.
Defending champions Senegal will take on Cameroon, Guinea and Gambia in Group C in Yamoussoukro.
Morocco - who reached the last four at the World Cup last December in Qatar, will face Zambia, Tanzania and Democratic Republic of Congo in Group F in San Pédro.
Nearly an hour of dancing, songs and speeches preceded the actual draw for the showpiece tournament of the Confederation of African Football (Caf).
Praise
Patrice Motsepe, who heads the Caf, told the audience at the Abidjan Convention and Exhibition Centre: "I'd like to extend our deep gratitude to the government of Cote d'Ivoire. Thanks for your partnership and the great work you've been doing.
"We're convinced that the Afcon in Cote d'Ivoire will be the best ever."
Group B, which will be played at the Felix Houphouet Boigny Stadium in Abidjan will feature the seven-time champions Egypt as well as Ghana, Cape Verde and Mozambique.
The 2019 winners Algeria will tussle with Burkina Faso, Mauritania and Angola at the Stade de la Paix in Bouaké in Group D while Tunisia, Mali, South Africa and Namibia will comprise Group E in Korhogo.
Challenge
Senegal striker Sadio Mane, who was part of the draw team, said: "I think it will be a difficult group but we will go out and do our best and try to go through to the knockout stages. We know it will be tough."
Achraf Hakimi, the Paris Saint-Germain and Morocco defender, who also assisted during the draw sequence, said: "My team will try to do its best just like we did at the World Cup."
The 24-team tournament, which was scheduled to take place in the summer of 2023, was pushed back to early 2024 due to the heavy rains that sweep through the country. However, the tournament has maintained the 2023 logo.
The top two from the six groups will advance to the last-16 automatically with four of the best third-placed teams.
The final will take place on 11 February at the same venue as the opening match.
Former Cote d'Ivoire skipper Didier Drogba - also part of the draw team - said: "I am sure the Cote d'Ivoire players will do their best.
"Their group is as difficult as the others and it will be challenging but we have a strong team and with Ivorians supporting them, they will do everything they can to make sure that the trophy stays in Cote d'Ivoire."