The emergency committee of the African Football Confederation (CAF) met Saturday in Lagos and unanimously decided to give Morocco the green light ahead of Equatorial Guinea. A third candidate, Ethiopia, was not considered because it did not provide a letter of guarantee from its government.
Original hosts Kenya fell behind with five-venue preparations for the biennial 16-team tournament, which runs from January 12-February 4, leading them to be stripped of the hosting rights last month.
Morocco have not hosted a senior CAF competition since the 1988 Africa Cup of Nations.
They were scheduled to stage the same event in 2015, but withdrew fearing visiting supporters could bring the deadly Ebola virus into the north African kingdom.
Equatorial Guinea successfully replaced Morocco at short notice, having co-hosted the Cup of Nations with Gabon three years earlier.
CHAN is restricted to home-based footballers, giving them international exposure otherwise largely denied because most African national squads are packed with professionals playing in Europe.