Herve Renard is standing down as Morocco head coach after their early exit from the Africa Cup of Nations.
Morocco were one of the pre-tournament favourites for Egypt 2019 but suffered a shock penalty shootout defeat by Benin in the last 16.
Renard, who won Africa Cup of Nations (AFCON) with Zambia (2012) and Ivory Coast (2015), had been in charge since February 2016.
"It is time for me to close this long and beautiful chapter of my life," said the Frenchman, 50.
In a statement on social media, Renard said he was "not without some emotion and sadness", adding: "It is an inevitable decision taken well before AFCON 2019.
"I took this decision after having - of course - carefully considered [it]. It is therefore irreversible."
Renard took Morocco from 81st in the FIFA world rankings to 47th.
He led them to two Africa Cup of Nations tournaments, and to the World Cup in Russia in 2018 - the first time the Atlas Lions had played at the global event for 20 years.
His hopes of winning a third AFCON title were dashed in Egypt, and Renard admitted it was not the outcome he had expected.