Spain’s World Cup-winning goalkeeper Iker Casillas announced his retirement on Tuesday.

He has been sidelined for more than a year due to a heart problem.

“Today is both one of the most important and most difficult days of my sporting life, the time to say goodbye has arrived,” he said on Twitter.

Casillas won the European Championship twice for Spain and played more than 700 games for Real Madrid.

He joined FC Porto in 2015 after a tearful departure from Madrid but suffered a heart attack in May last year.

He played 167 times for the national team, winning the 2010 World Cup and the Euros in 2008 and 2012 in a golden age for Spanish football.

He lifted five La Liga titles and the Champions League on three occasions during his time at the Santiago Bernabeu.

“The best goalkeeper in the history of Real Madrid and Spanish football joined us at the age of 9. He was formed here and defended our shirt for 25 years, becoming one of our most emblematic captains of all time,” the club said in a statement.

“Today one of the most important footballers in our 118 years of history calls it a day as a professional player, a player we love and admire, a goalkeeper who has made the Real Madrid legacy bigger with his work and exemplary behaviour both on and off the pitch,” they added.