CAIRO — Egypt goalkeeper Essam El Hadary is retiring from the national team after becoming the oldest man to play in a World Cup match.

El Hadary started the World Cup as Egypt's backup goalkeeper, but he played in his team's final group match in Russia, saving a penalty in the 2-1 loss to Saudi Arabia on June 25.

"After 22 years, four months and 12 days, I saw it as the best moment to hang up my gloves," the 45-year-old El Hadary wrote on Facebook. "This is a moment I didn't want to come ... I am very proud to have played with the national team in 159 internationals, participating in unprecedented achievements."

El Hadary made his debut for the national team in 1996. He won four African Cup of Nations titles with Egypt, including three straight with him as goalkeeper in 2006, 2008 and 2010.

Teammate Mohamed Salah hailed the veteran goalkeeper on Twitter.

"A new legend from a great golden generation is leaving us," the Liverpool forward wrote Tuesday.

In Russia, El Hadary overtook Faryd Mondragon, who was 43 when he came on as a late substitute in Colombia's 4-1 victory over Japan four years ago at the World Cup in Brazil.

El Hadary, who will continue to play for Egyptian club Ismaili, first rose to prominence with Cairo club Al-Ahly, but he fell out with management and left in 2008 for Switzerland. Since then, El Hadary he has become something of a soccer nomad, playing for several clubs in Egypt, Sudan and Saudi Arabia.