Spain captain Iker Casillas spent a glorious quarter-century at Real Madrid but hit a rough patch in his last years at his boyhood club which sold him Saturday to FC Porto.

In 2010 Casillas, now 34, made front pages worldwide in a photograph of him raising the World Cup in South Africa after leading Spain to the title for the first time.

But last summer the image was of a dejected Casillas on his knees as a rout by the Netherlands helped dump Spain out of the World Cup in Brazil.

With Madrid, Casillas had enchanted the Bernabeu Stadium for years with his catlike reflexes, gravity-defying saves and fearless one-on-ones, earning the nickname “Saint Iker” from fans.

Off the pitch, the square-jawed athlete and his television presenter girlfriend Sara Carbonero are darlings of the glossy celebrity magazines along with their toddler son Martin.

In 2000, Iker, the boy from the Madrid suburb of Mostoles, became the youngest ever goalkeeper to play in a Champions League final, at 19 years and four days of age. He kept a clean sheet in that 3-0 win over Valencia.

He went on to scale the heights with Real, racking up five Spanish and three European league titles plus 11 other trophies with the club.

But his lustre dimmed over the past three years for Real Madrid and in the end the club did not hesitate to get rid of him as they develop a younger squad.

They sold him to the Portuguese side despite Casillas making it clear he wanted to see out his contract at Real to 2017.

Reputed to be a conciliator in the dressing room, Casillas was caught up in internal squabbling in the 2012-2013 season under combative coach Jose Mourinho.

Real Madrid training

In the 2012-2013 season Mourinho left Casillas on the bench for a long spell and accused him of leaking details of dressing room squabbles to the press.

Mourinho was also reportedly angry with Casillas for reaching out to Barcelona’s captain Xavi Hernandez in a bid to calm tensions after a brawl between the rival teams in the Spanish Super Cup in 2012.

Casillas had to compete hard with Diego Lopez for the goalkeeper’s spot and suffered jeers from some of Real’s demanding fans while also making a series of uncharacteristic mistakes.

The low point in his malaise came when the Dutch beat Spain 5-1 in the group stage of last year’s World Cup, leaving him looking like a fallen giant.

In the 2008 Euro championship, Casillas had saved two Italian penalties as Spain headed for a first tournament win in 44 years.

Real Madrid vs Getafe

He was a hero in another penalty shootout in 2012 at the Euros to deny Portugal in the semi-finals.

He went down in history in 2010 when he made a fine stop with his outstretched foot to prevent Arjen Robben scoring for the Dutch in the World Cup.

Five years later he has not lost his gift for such one-on-one duels — he made two decisive stops against Belarus in a Euro qualifier in June which Spain won 1-0.

The image of captain Casillas lifting the cup in Johannesburg enthroned him as one of the stars of a golden generation of Spanish players.

Spain’s most capped player, with 162 international appearances, he remains in favour with national coach Vicente del Bosque.

But Spain’s golden generation is being renewed. Hernandez left Barcelona at the end of the past season.

. Spanish soccer players association announces strike

Real now reportedly have their sights set on Manchester United keeper David de Gea, 24.

Casillas has hailed de Gea as “a goalkeeper for the present and the future”.

But de Gea faces enormous expectations, replacing a hero at such a demanding club.

“Real Madrid demands a lot of you, more each year,” Casillas told Cadena Ser radio in May.