Diego Lopez
Diego Lopez has excelled on loan at Espanyol during the 2016-2017 season Getty

Diego Lopez has completed a permanent move from AC Milan to Espanyol after being heavily linked with a move to Chelsea during the past two transfer windows. The former Real Madrid keeper has committed his future to the La Liga side until 2020 and the club set his release clause at €50m (£43.2m, $56m) to ward off potential suitors.

Lopez, 35, reportedly attracted the attention of Liverpool and Chelsea during the last summer transfer window after it emerged that he was likely to leave Milan following the impressive breakthrough of promising Gianluigi Donnarumma into the Serie A giants.

Chelsea were at the time looking for a veteran third-choice keeper to replace Marco Amelia but finally brought Portugal goalkeeper Eduardo from Dinamo Zagreb. Meanwhile, Lopez agreed a loan move to Espanyol on deadline day to fill the gap left by the departure of Pau Lopez to Tottenham

The former Real Madrid keeper was originally expected to serve as a back-up for Roberto Jimenez but eventually become the first-choice for Quique Sanchez Flores after recovering his best form during an impressive first part of the season.

The Guardian then reported that Antonio Conte had renewed his interest in luring the Spaniard to Chelsea amid the expected departure of Asmir Begovic to Bournemouth.

Lopez welcomed the interest from Chelsea at the time but decided to continue at Espanyol until the end of the season – with the Blues also blocking the departure of Begovic after failing to sign a replacement.

Last month Lopez confirmed that he seriously though about joining Chelsea in the past but insisted that his priority for the coming summer transfer window was to complete a permanent move to Espanyol – even if the Blues come back knocking again.

"There was an opportunity last summer," he was quoted as saying by AS on the subject of joining Chelsea. "I was very flattered by the manager's interest. I don't know if it will be maintained this summer. Last year it was a priority option but now things have changed, and I don't know what will happen, it's one of the big clubs in Europe and it will probably win the Premier League. My idea has not changed at all and my intention is to continue at Espanyol. I hope it happens."

And Espanyol have now fulfilled the wishes of the former Real Madrid keeper after agreeing terms with Milan to secure his services until 2020.

"Diego Lopez and RCD Espanyol have reached an agreement for which the Galician goalkeeper will definitely join the squad of the first team. The goalkeeper has signed his commitment with RCD Espanyol until 30 June, 2020 and will have a clause of €50m," the club have confirmed.

"The player has been one of the pillars of the team this campaign. In fact, the Galician has received 38 goals in 35 games this season. The international goalkeeper, who has always expressed his will to continue playing for Espanyol, has been able to achieve one of his dreams that was to continue defending the white and blue jersey."

Meanwhile, the Chelsea situation between the sticks remains uncertain as Begovic is said to be likely to move away to secure regular time somewhere else.