Defending champion Algeria was dumped out of the African Cup of Nations in the group stage on Thursday with a 4-1 loss to an Ivory Coast team that was rampant at times.

It meant Algeria, which was again viewed as one of the title contenders, exited without a win after two shock results earlier in the tournament left it bottom of Group E and needing to beat Ivory Coast to progress.

More Images
Ivory Coast's Nicolas Pepe, right, is challenged by Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Defending champion Algeria was dumped out of the African Cup of Nations in the group stage on Thursday with a 4-1 loss to an Ivory Coast team that was rampant at times.

Ivory Coast's Serge Aurier, right, controls the ball as Algeria's Ramy Bensebaini watches on, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Riyad Mahrez missed a penalty for Algeria after 60 minutes but his team did pull one back through Sofiane Bendebka's header. However, that did nothing to soften the blow of a disastrous tournament for the North Africans and Sébastien Haller headed in the fourth for Ivory Coast in the third minute of injury time.

Ivory Coast's head coach Patrice Beaumelle gives instructions during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast finished top of Group E and Equatorial Guinea clinched second place and the other automatic spot in the round of 16 by beating 10-man Sierra Leone 1-0 in the other group game.

Ivory Coast's Franck Kessie, right, scores a goal as Algeria's Youcef Atal looks on during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Franck Kessie, right, scores a goal as Algeria's Youcef Atal looks on during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Equatorial Guinea's Pablo Ganet celebrates scoring during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Equatorial Guinea's Pablo Ganet celebrates scoring during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Ivory Coast's Serge Aurier, left, vies for the ball with Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Serge Aurier, left, vies for the ball with Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Sierra Leone's Umaru Bangura, left, challenges Equatorial Guinea's Frederico Nchama, right, during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Sierra Leone's Umaru Bangura, left, challenges Equatorial Guinea's Frederico Nchama, right, during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Ivory Coast's Nicolas Pepe, right, celebrates with teammates after scoring during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Nicolas Pepe, right, celebrates with teammates after scoring during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Algeria's Said Benrahma, right, watches on as Ivory Coast's Serge Aurier kicks the ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Algeria's Said Benrahma, right, watches on as Ivory Coast's Serge Aurier kicks the ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

It didn't come close to doing that as Ivory Coast surged into a 3-0 lead through goals by Franck Kessié and Ibrahim Sangaré in the first half and Nicolas Pépé in the 54th minute.

Ivory Coast's Nicolas Pepe, right, is challenged by Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Nicolas Pepe, right, is challenged by Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Riyad Mahrez missed a penalty for Algeria after 60 minutes but his team did pull one back through Sofiane Bendebka's header. However, that did nothing to soften the blow of a disastrous tournament for the North Africans and Sébastien Haller headed in the fourth for Ivory Coast in the third minute of injury time.

Algeria began its defense with a surprise 0-0 draw with Sierra Leone and then was at the wrong end of one of the biggest upsets in African Cup history when it lost 1-0 to Equatorial Guinea.

Algeria followed another former champion, Ghana, in being eliminated in the group stage in Cameroon.

Ivory Coast's Serge Aurier, right, controls the ball as Algeria's Ramy Bensebaini watches on, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Serge Aurier, right, controls the ball as Algeria's Ramy Bensebaini watches on, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast finished top of Group E and Equatorial Guinea clinched second place and the other automatic spot in the round of 16 by beating 10-man Sierra Leone 1-0 in the other group game.

There were other repercussions from that Sierra Leone loss, not least that the tiny island nation of Comoros qualified for the knockout stage in its first appearance at the African Cup as one of the four best third-place teams.

More AP soccer: https://apnews.com/Soccer and https://twitter.com/AP_Sports

Ivory Coast's head coach Patrice Beaumelle gives instructions during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's head coach Patrice Beaumelle gives instructions during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Franck Kessie, right, scores a goal as Algeria's Youcef Atal looks on during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Franck Kessie, right, scores a goal as Algeria's Youcef Atal looks on during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Ibrahim Sangaré jumps forth ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Equatorial Guinea's Pablo Ganet celebrates scoring during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Equatorial Guinea's Pablo Ganet celebrates scoring during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Ivory Coast's Serge Aurier, left, vies for the ball with Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Serge Aurier, left, vies for the ball with Algeria's Said Benrahma, during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Sierra Leone's Umaru Bangura, left, challenges Equatorial Guinea's Frederico Nchama, right, during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Sierra Leone's Umaru Bangura, left, challenges Equatorial Guinea's Frederico Nchama, right, during the African Cup of Nations 2022 group E soccer match between Sierra Leone and Equatorial Guinea at the Omnisport Stadium in Limbe, Cameroon, Thursday Jan. 20, 2022. (AP PhotoSunday Alamba)

Ivory Coast's Nicolas Pepe, right, celebrates with teammates after scoring during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Ivory Coast's Nicolas Pepe, right, celebrates with teammates after scoring during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Algeria's Said Benrahma, right, watches on as Ivory Coast's Serge Aurier kicks the ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)

Algeria's Said Benrahma, right, watches on as Ivory Coast's Serge Aurier kicks the ball during the African Cup of Nations 2022 group E soccer match between Ivory Coast and Algeria at the Japoma Stadium in Douala, Cameroon, Thursday, Jan. 20, 2022. (AP PhotoThemba Hadebe)