Draw for 2018 CHAN pits Nigeria against former winners Libya
The draw for the 2018 African Nations Championship (CHAN) was made in Rabat on Friday night, with Nigeria grouped alongside Libya - the only former winners in the 16 teams taking part.
The tournament, which is for African footballers based in their own domestic leagues, will be staged in Morocco between 12 January and 4 February.
The Nigerians are making a third consecutive appearance in the biennial event, and will also face Rwanda and Equatorial Guinea in their group.
Nigeria finished third in 2014 in South Africa, but failed to reach the knockout phase in Rwanda last year.
Rwanda were the last qualifiers for Morocco 2018, winning a play-off against Ethiopia last weekend after Egypt withdrew because top clubs were not prepared to release players.
Equatorial Guinea are debutants and qualified without kicking a ball after opponents Gabon withdrew from the regional qualifying competition.
Namibia, Uganda and Zambia were placed in a group with Ivory Coast, who came third last year behind champions the Democratic Republic of Congo and runners-up Mali.
Uganda will be desperate to at least reach the quarter-finals after three first-round exits in a row, while the best showing from Zambia was third at the first tournament in 2009.
Namibia are the other debutants after shocking Zimbabwe in a qualifier despite fielding a rusty squad because of the lack of domestic football.
The other group is made up of 2011 runners-up Angola, Cameroon, Congo Brazzaville and Burkina Faso.
Casablanca, Agadir, Marrakech and Tangier will stage matches.
The winning nation will win $1.25 million - up from the $750,000 DR Congo received in Kigali last time out.
Group A (Casablanca)
Morocco, Guinea, Sudan, Mauritania
Group B (Marrakech)
Ivory Coast, Zambia, Uganda, Namibia
Group C (Tangier)
Libya, Nigeria, Rwanda, Equatorial Guinea
Group D (Agadir)
Angola, Cameroon, Congo Brazzaville, Burkina Faso