Casillas leaves Real for new challenge at Porto
Casillas made his debut for Real in September 1999, at the age of 18.
Casillas, 34, became a hero for both Real and Spain during a glittering career, where he has won three Champions Leagues with Real and the World Cup and two European Championships with La Roja.
But in recent years he lost some of the sheen that earned him the nickname "Saint Iker" and last term was regularly whistled by disgruntled fans at the Bernabeu as the world's richest club ended the campaign without major silverware.
Real's announcement of their captain's departure, which ended days of frenzied speculation in the Spanish media, came exactly five years since the Spain captain triumphantly hoisted aloft the nation's first World Cup in South Africa after a 1-0 victory over the Netherlands.
The expected arrival at Real of Manchester United's David De Gea, the 24-year-old former Atletico Madrid man who is being groomed to take over as Spain keeper, will also have contributed to Casillas's decision to move on.
Regular playing time in Portugal for Porto, coached by Spanish ex-keeper Julen Lopetegui, should allow him to extend his international career at least until next year's European Championship in France.
"Thank you Iker, for everything," Real said on their website. "Thank you for being a symbol of the best in our history. You are leaving but we will not forget that you belong in Real Madrid's heart forever."
Casillas made his debut for Real in September 1999, aged 18, and as well as three European crowns he has also won five La Liga titles, two King's Cups and one Club World Cup.
He made 725 appearances for Real, second only to former striker Raul, and was named the world's best keeper five times by the International Federation of Football History and Statistics (IFFHS).
"For Real Madrid today is a day, above all, of appreciation and recognition," Real said.
"Today, the best goalkeeper in the history of Real Madrid and in the history of Spanish football is leaving the team and beginning a new stage in his career."
Casillas will hold a farewell news conference on Sunday at the Bernabeu.