Real Madrid captain and goalkeeper Iker Casillas will leave the Spanish La Liga top club after two and a half decades for FC Porto.
"Real Madrid have agreed to the transfer of Iker Casillas to the Portuguese club," Real Madrid said in a statement on Saturday after three days of intense negotiations, Xinhua reported.
Casillas joined Real's youth academy at age nine in 1990 and won 19 trophies during his 16 seasons as a professional. He played 725 matches.
"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," the statement added.
Real is reportedly trying to sign Manchester United's 24-year-old Spanish goalkeeper David de Gea as a replacement.
The club finished second in La Liga last season behind Barcelona, who also won the Champions League title.