Porto have agreed a deal to sign Spain goalkeeper Iker Casillas from Real Madrid.
Casillas, 34, who had one year left on his contract, leaves Real after 25 years, during which time he won three Champions Leagues and five Liga titles.
He holds the record for Spanish caps (162) and has won two European Championships and the World Cup.
Manchester United goalkeeper David De Gea, 24, has been linked with a move to Madrid to replace Casillas.
Casillas joined Real's youth academy in 1990, made his first team debut in 1999 and has spent his career at the club, winning 17 major honours.
He was dropped by Jose Mourinho in 2012-13, with the Portuguese manager favouring Diego Lopez.
In the 2013-14 season manager Carlo Ancelotti played Casillas only in the Champions League and Copa del Rey as Real Madrid won their 10th European Cup.
Last season he was restored as first-choice keeper but De Gea is expected to replace him as Real and Spain's number one.
|Casillas' trophy haul|
|3 x Champions League (2000, 2002, 2014)||2 x Copa del Rey (2011, 2014)|
|5 x La Liga (2001, 2003, 2007, 2008, 2012)||1 x Club World Cup (2014)|
|1 x World Cup (2010)||2 x European Cup (2008, 2012)|
An emotional farewell
Real Madrid's statement in full on Casillas' departure:
"For Real Madrid today is a day, above all, of thanks and recognition. One of the best goalkeepers in this club is not just leaving, today the greatest goalkeeper in the history of the club and in the history of Spanish football is moving on to a new stage in his footballing career.
"This goodbye evokes thousands of sensations and memories charged with hope, anticipation, sacrifice, strength and unique triumph. Iker Casillas has made our coat of arms even greater. He has been our captain and has forged his legend here since he arrived as a child at just nine years of age.
"Our club is 113 years old and Casillas has worn our jersey for 25 of those years. During that time he has become one of our finest leaders and has won the respect, affection, admiration and love of the fans beyond colours and affiliations.
"Iker is leaving, but his legacy is here forever. His attitude and actions in the 725 games he played in the our jersey shine a light on the path for those who dream of being part of this team.
"Thank you Iker, for everything you have done. Thank you for being a symbol of the best in our history. You are going but we will never forget that you'll always belong to the heart of Real Madrid."
Find all the latest football transfers on our dedicated page.