Former Spain and Real Madrid goalkeeper Iker Casillas announced his retirement on Tuesday, after being sidelined for more than a year with a heart problem. Casillas, 39, helped Spain win the 2010 World Cup and two successive European Championships in 2008 and 2012. He played 167 times for his country in a golden era for Spanish football. He made 725 appearances for Real during a 16-year career at the Bernabeu, winning three Champions League titles and five La Liga crowns. "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. "The important thing is the path you travel and the people who accompany you, not the destination to which it takes you. "I think I can say, without hesitation, that it has been the path and the dream destination." Casillas joined Portuguese side Porto in 2015 after a tearful departure from Madrid. He suffered a heart attack in May last year. "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." Former club and country team-mate Sergio Ramos was among many players to praise the veteran, nicknamed 'The Saint', on social media. "Football thanks you, man. Forever a legend @IkerCasillas," Ramos tweeted.