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 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.
"We had all hoped [for] better for the Afcon 2019 in Egypt. But this is football - it gives birth to the wildest hopes (after three wins in the first round [for the] first time in Afcon final tournament for Morocco), and brings us hard to the reality of a too-quick elimination on penalties!"