Hakim Ziyech celebrates with his Morocco teammates
Hakim Ziyech (L) celebrates with his Morocco teammates after scoring against Zambia. AFP

Morocco's 1-0 win over Zambia at the Africa Cup of Nations on Wednesday had the knock-on effect of sending Ivory Coast through to the last 16, after a day in which the tournament hosts sacked their coach.

The final day of group-stage action also saw Namibia secure a place in the knockout stage of an AFCON for the first time, while South Africa progressed and several of the continent's heavyweights responded to shock eliminations by parting company with their managers.

Much-fancied Morocco beat Zambia in San-Pedro to finish top of Group F and condemn the Chipolopolo, coached by Avram Grant, to a first-round exit.

Hakim Ziyech scored the only goal of the game late in the first half and the Atlas Lions will stay in San-Pedro for a last-16 clash with South Africa next Tuesday.

They will be without coach Walid Regragui on the touchline for that game in which he will complete a two-match ban handed down on Wednesday following incidents at the end of Morocco's 1-1 draw with the Democratic Republic of Congo last weekend.

Morocco's result was celebrated all over the host nation as it allowed Ivory Coast to squeeze into the next round as one of the four best third-placed teams.

The Elephants had been staring at the prospect of a humiliating group-stage exit after a stunning 4-0 defeat by Equatorial Guinea on Monday.

They were the first Cup of Nations host in 40 years to lose two group games, but a 2-0 victory over Guinea-Bissau in their opening match ultimately proved sufficient.

However, they now face a daunting tie against reigning champions Senegal in capital city Yamoussoukro next Monday, and they will do so with a new coach.

Veteran French boss Jean-Louis Gasset was dismissed by the Ivorian Football Federation (FIF) on Wednesday, with assistant Emerse Fae stepping up to replace him.

Fae played alongside Didier Drogba in the Ivorian team that lost the 2006 AFCON final to Egypt.

"We are pleased. Things have been difficult since Monday. We have been holding our breath," Fae told broadcaster Canal Plus Afrique after their qualification was confirmed.

"We were disappointed with our own result and we were also scared that we might not qualify at our own AFCON.

"This is a relief. It lifts a weight off our shoulders but now we need to quickly turn our focus to the match against Senegal.

"We owe the people of Ivory Coast and we have to show them that the result against Equatorial Guinea was an accident."

DR Congo qualified for the last 16 in second place in Group F behind Morocco after a 0-0 draw with Tanzania in Korhogo.

A third draw in as many matches allowed the Leopards to progress to a tie against record seven-time champions Egypt in San-Pedro on Sunday.

Tanzania go home after finishing bottom of the group, and they have still never won a Cup of Nations match in nine attempts across three appearances at the finals.

Namibia qualified for the knockout stage for the first time thanks to a 0-0 draw against Mali in San-Pedro, a result which saw the Brave Warriors finish with four points in Group E and progress as one of the best third-placed sides.

Appearing at their fourth Cup of Nations, Namibia now take on neighbours Angola in Bouake on Saturday with a quarter-final place at stake.

Mali finished top of the group and can look forward to a tie against Burkina Faso which is likely to draw a big crowd to Korhogo, the city situated close to Ivory Coast's borders with both countries.

There had been no goalless draws at all at this Cup of Nations until Wednesday, when three of the four matches ended 0-0, including South Africa's meeting with Tunisia.

That result allowed Bafana Bafana to advance but eliminated 2004 champions Tunisia, the third-ranked nation in Africa.

Tunisia coach Jalel Kadri announced he was stepping down after that result, saying in a television interview: "My decision is definite. My contract fixed as an objective the semi-finals and because we haven't made that the contract is over."

Algeria coach Djamel Belmadi and Ghana's Chris Hughton were sacked after both countries were knocked out of the tournament on Tuesday.