Morocco will replace Kenya as hosts of the 2018 African Nations Championship (CHAN), organisers announced on Sunday.
The Confederation of African Football (CAF) unanimously decided to give Morocco the tournament ahead of Equatorial Guinea.
They replace Kenya, who had their rights to host withdrawn by CAF due to a lack of preparation.
The tournament for locally-based players is scheduled to take place in January and February 2018.
The decision to move the competition was made at an emergency CAF executive committee meeting in Lagos, Nigeria.
Third candidates, Ethiopia, were not considered, after not providing a letter of guarantee from the country's government.
The awarding of the tournament to Morocco also benefits Egypt, who were awarded Morocco's place - now freed up as hosts - after being initially knocked out by their fellow North Africans in qualifying.
It will be Egypt's first appearance in the competition.
Kenya's preparations were deemed unsuitable for the biennial 16-team tournament - which runs from 12 January to 4 February 2018 - leading them to be stripped of the hosting rights last month.
Morocco have not hosted a senior continental competition since the 1988 Africa Cup of Nations.
They were due to stage the Nations Cup in 2015, but lost the hosting rights, after expressing fears over the spread of the Ebola virus.