The Morocco Football Federation has appointed former international Badou Zaki as the country's new national coach.
Zaki takes charge of the Atlas Lions for the second time in his career.
He replaces interim coach Hassan Benabicha as Morocco prepare to host next year's Africa Cup of Nations.
Mustapha Hadji, the former Morocco midfielder, has been named as Zaki's assistant coach.
Several big names were linked with the head coach position, including former Zambia boss Herve Renard, Italian Giovanni Trapattoni and Dutchman Dick Advocaat.
55-year-old Zaki is a former international goalkeeper and played for Morocco at the 1984 Los Angeles Olympics and the World Cup two years later in Mexico.
He was appointed national team coach in 2002 leading them to the final of the 2004 Nations Cup, where they lost 2-1 in the final to hosts Tunisia.
His first term in charge ended in 2005 when he resigned following Morocco's failure to qualify for the 2006 World Cup finals in Germany.
Zaki has had a varied coaching career at club level in his home country, including winning the championship with Wydad Casablanca.
As a player, he made his name as the goalkeeper who helped Morocco to become the first African country to advance past the first round at the World Cup when they beat Portugal and drew with England and Poland in Mexico in 1986.
He defied West Germany in the knockout round with a series of stunning saves until a late freekick from Lothar Matthaeus put Morocco out.