Goalkeeper Iker Casillas is leaving Real Madrid to join Portuguese club FC Porto after 16 seasons in which he helped the Spanish powerhouse win a slew of titles that included three Champions League crowns and five Spanish league trophies.

Madrid announced on its website Saturday that a deal had been reached for Casillas’ transfer to Portugal.

Casillas joined Madrid’s youth academy at the age of 9 and made his debut for its first team in 1999, before going on to become a long-serving captain who was regularly hailed by fans as “Saint Iker” because his daring saves seemed to them almost miraculous.

Casillas also captained Spain to the 2010 World Cup title _ making a key save to deny Arjen Robben in the final against the Netherlands _ and helped it win two European championships.

Casillas’ departure opens the door for a new goalkeeper and Manchester United’s David de Gea has frequently been linked with a return to his hometown, where he played for Atletico Madrid.

Madrid says Casillas will give a news conference at noon local time on Sunday.

Once considered untouchable at Madrid, Casillas was benched by former coach Jose Mourniho in December 2012 and then found it hard to get back in the starting 11 following a hand injury the following month.

Casillas, 34, was under contract at Madrid until 2017.

At Porto he will be under the instructions of Spanish coach and former goalkeeper Julen Lopetegui, who helped the club reach the Champions League quarterfinals last season.

Casillas first Champions League title came in his debut season at the age of 19. His second European Cup came two years later, when he came on as a second-half substitute to make key saves in the final.

He then had to wait until 2014 for the third, but won a long list of trophies in-between.

Casillas’ exit was unimaginable for most Madrid fans just a couple of years ago, but his stature faded over the last couple of seasons.

Mourinho’s successor Carlo Ancelotti kept Casillas as Diego Lopez’s backup in the Spanish league in 2013-14, but played him in the Champions League and Copa del Rey. Casillas’ confidence also appeared to be shaken in the opening match of the 2014 World Cup when he had a dreadful performance in Spain’s 5-1 loss to the Netherlands. Spain failed to advance past the group stage and Casillas was heavily criticized.

Casillas was back to starting league games last season, but his performances were constantly scrutinized by many fans who continued to insist he had lost his quick reflexes and confident demeanor.

Some segments of Madrid’s faithful at the Santiago Bernabeu Stadium began jeering Casillas whenever he conceded goals or made dubious moves.

Madrid’s failure to win a major trophy and the fans’ growing disquiet reportedly prompted club president Florentino Perez to dispense with a player once considered a talisman.

Casillas’ farewell after 725 matches with Madrid comes in the same summer that friend and rival Xavi Hernandez left Barcelona to play in Qatar.

Casillas’ future with the Spanish national team will now be questioned even further, as coach Vicente del Bosque carries out his “sweet revolution” to rejuvenate the side for the 2016 Euros in France. He is still Del Bosque’s No. 1 `keeper, but that could change if De Gea continues to make strides.