Djamel Belmadi sank to his knees, eyes closed and arms aloft after Riyad Mahrez's goal with seconds remaining put Algeria in the African Cup of Nations final for the first time in 29 years.

About two hours earlier, Senegal's Aliou Cisse celebrated a place in Africa's biggest game and a chance at a first title for his country in the same way.

More Images
Algeria's Riyad Mahrez celebrates with his teammates after scoring his team's second goal during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Djamel Belmadi sank to his knees, eyes closed and arms aloft after Riyad Mahrez's goal with seconds remaining put Algeria in the African Cup of Nations final for the first time in 29 years.

Algeria's head coach Djamel Belmadi celebrates after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAmr Nabil)

Friday's African Cup final in Cairo will be headlined by the teams' Premier League stars: Senegal forward Sadio Mane of Liverpool and Algeria captain Mahrez of Manchester City. They have lived up to their reputations with high-quality performances at the tournament.

Algerian fan celebrates after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAriel Schalit)

The coaches have compelling stories. They are young in the coaching game at age 43. They spent formative years growing up and playing in France, where they came across each other. They are former national team players for their countries who have graduated to the top job, which is uncommon in Africa.

Senegal's head coach Aliou Cisse celebrates after the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Belmadi played for Algeria in the early 2000s. He's been coach for less than a year but has taken the team to the final for the first time since the country won its sole title on home soil in 1990.

Algerian players celebrate after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAmr Nabil)

"I have unlimited trust in my players, and I felt they wanted to achieve something," Cisse said. "They have done all that is needed to win. My players told me they will be better than us (in 2002), and they have been."

Senegal's Sadio Mane, left, goes for the ball pasty Tunisia's Oussama Hadadi during the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

They have their own styles. Cisse wears crisp white shirts and smart trousers on the sidelines and embodies calm. Belmadi favors untucked T-shirts and tracksuit pants and is a whirlwind of activity.

Algeria's Riyad Mahrez scores his team's second goal during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Underlining both teams' efforts in Egypt is a prolonged yearning for success.

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

That's provided an extra element for the final.

Algeria's Riyad Mahrez scores the winning goal during the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. Algeria won 2-1. (AP PhotoAriel Schalit)

Large soccer crowds have made Egyptian authorities so nervous in the past few years that fans were banned completely from attending games. The 75,000-seat Cairo International Stadium is expected to be full for the final.

Guinea's Ernest Seka in action in front of Algeria's Riyad Mahrez during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoHassan Ammar)

Guinea's Ernest Seka in action in front of Algeria's Riyad Mahrez during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoHassan Ammar)

Algeria's head coach Djamel Belmadi gestures during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Algeria's head coach Djamel Belmadi gestures during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Algeria's Riyad Mahrez controls the ball during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. Algeria won 3-0. (AP PhotoHassan Ammar)

Algeria's Riyad Mahrez controls the ball during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. Algeria won 3-0. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse team lines up for the anthems before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse team lines up for the anthems before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal fans cheer before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal fans cheer before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

It was striking how two coaches who are good friends, who played against each other in their early days, and who were born just a day apart, expressed their joy with almost carbon-copy acts.

Algeria's Riyad Mahrez celebrates with his teammates after scoring his team's second goal during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Algeria's Riyad Mahrez celebrates with his teammates after scoring his team's second goal during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Friday's African Cup final in Cairo will be headlined by the teams' Premier League stars: Senegal forward Sadio Mane of Liverpool and Algeria captain Mahrez of Manchester City. They have lived up to their reputations with high-quality performances at the tournament.

For Champions League-winning Mane or Premier League-winning Mahrez, it'll be a season to savor. They both have three goals in Egypt, setting up the chance of a definitive fourth from one of them.

But it's much more than Mane vs. Mahrez.

Algeria's head coach Djamel Belmadi celebrates after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAmr Nabil)

Algeria's head coach Djamel Belmadi celebrates after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAmr Nabil)

The coaches have compelling stories. They are young in the coaching game at age 43. They spent formative years growing up and playing in France, where they came across each other. They are former national team players for their countries who have graduated to the top job, which is uncommon in Africa.

It's also rare that they've both reached the pinnacle of a tournament nearly monopolized by foreign coaches. In 31 previous African Cups, there have only been four finals to feature two African coaches. It last happened in 1998 and before that in the 1960s and '70s.

"It's a great message that we have sent to those responsible for football in all countries in Africa. It's amazing," Belmadi said. "I've known Cisse for a very long time. We used to play against each other when we were both in France. To play this final against Senegal, against my friend, is amazing."

Algerian fan celebrates after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAriel Schalit)

Algerian fan celebrates after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAriel Schalit)

Belmadi played for Algeria in the early 2000s. He's been coach for less than a year but has taken the team to the final for the first time since the country won its sole title on home soil in 1990.

Senegal has no titles, with defeat in the 2002 final, when Cisse himself missed the decisive penalty in a shootout, the closest it has come.

Cisse captained that 2002 team, which went on to make the World Cup quarterfinals four months later and stands out as one of Africa's best.

Senegal's head coach Aliou Cisse celebrates after the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse celebrates after the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

"I have unlimited trust in my players, and I felt they wanted to achieve something," Cisse said. "They have done all that is needed to win. My players told me they will be better than us (in 2002), and they have been."

Both coaches have deep-rooted connections to their teams.

Belmadi was at the center of Algeria's celebrations after the semifinal against Nigeria. The coach knelt as the players surrounded him. Cisse was also the focal point for Senegal in the extra-time win over Tunisia as jubilant players jumped into his arms.

Algerian players celebrate after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAmr Nabil)

Algerian players celebrate after the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoAmr Nabil)

They have their own styles. Cisse wears crisp white shirts and smart trousers on the sidelines and embodies calm. Belmadi favors untucked T-shirts and tracksuit pants and is a whirlwind of activity.

They met in the group stage, when Algeria won 1-0.

"We know them, they know us," said Mahrez.

Senegal's Sadio Mane, left, goes for the ball pasty Tunisia's Oussama Hadadi during the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's Sadio Mane, left, goes for the ball pasty Tunisia's Oussama Hadadi during the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Underlining both teams' efforts in Egypt is a prolonged yearning for success.

Algeria's passage to the final was greeted by mass celebrations on the streets at home. In Dakar, thousands danced outside the official residence of Senegal President Macky Sall. The winners will return as national heroes.

Senegal was always one of the title favorites and is the top-ranked team in Africa. Algeria came in under the radar, but the expectation appears to be heavier on the Algerians now, with thousands of their fans in Cairo.

Algeria's Riyad Mahrez scores his team's second goal during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Algeria's Riyad Mahrez scores his team's second goal during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

That's provided an extra element for the final.

Egypt has experienced revolution and horrific violence on its streets since 2011. The tournament has been played under intensely heavy security.

The only flash of trouble came when Algeria fans and local Egyptians — who have a fierce North African rivalry — threw bottles and goaded each other over fences separating them at Cairo International Stadium during the semifinal. Security swooped in to quell the trouble.

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Large soccer crowds have made Egyptian authorities so nervous in the past few years that fans were banned completely from attending games. The 75,000-seat Cairo International Stadium is expected to be full for the final.

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

Algeria's Riyad Mahrez scores the winning goal during the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. Algeria won 2-1. (AP PhotoAriel Schalit)

Algeria's Riyad Mahrez scores the winning goal during the African Cup of Nations semifinal soccer match between Algeria and Nigeria in Cairo International stadium in Cairo, Egypt, Sunday, July 14, 2019. Algeria won 2-1. (AP PhotoAriel Schalit)

Guinea's Ernest Seka in action in front of Algeria's Riyad Mahrez during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoHassan Ammar)

Guinea's Ernest Seka in action in front of Algeria's Riyad Mahrez during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoHassan Ammar)

Algeria's head coach Djamel Belmadi gestures during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Algeria's head coach Djamel Belmadi gestures during the African Cup of Nations round of 16 soccer match between Guinea and Algeria in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. (AP PhotoAriel Schalit)

Algeria's Riyad Mahrez controls the ball during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. Algeria won 3-0. (AP PhotoHassan Ammar)

Algeria's Riyad Mahrez controls the ball during the African Cup of Nations round of 16 soccer match between Algeria and Guinea in 30 June stadium in Cairo, Egypt, Sunday, July 7, 2019. Algeria won 3-0. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse team lines up for the anthems before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse team lines up for the anthems before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's head coach Aliou Cisse celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal fans cheer before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal fans cheer before the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)

Senegal's Sadio Mane, center, celebrates end of the African Cup of Nations semifinal soccer match between Senegal and Tunisia in 30 June stadium in Cairo, Egypt, Sunday, July 14, 2019. (AP PhotoHassan Ammar)