Nacho Fernández has left Real Madrid ahead of an expected move to the Saudi Pro League, the club announced on Tuesday.
Nacho captained the team to the Champions League and LaLiga double this season but has left the club at the end of his contract.
The 34-year-old defender has won a joint-club record 26 trophies, including six Champions League titles, with Madrid, having joined the club aged 10. He made his first-team debut in 2012.
He is part of the Spain squad, who beat Albania, 1-0, on Monday to advance to the European 2024 knockout round.
Sources have told ESPN that he is set to sign for Al Qadsiah in the SPL. He had been in advanced talks with Al Ittihad, but the centre-back was then offered a deal by Al Qadsiah and decided to accept it as he was keen to resolve his future as soon as possible, the source added.
"Real Madrid would like to thank and express our appreciation to Nacho, one of the club's biggest legends," the statement said. "Every Real Madrid fan is extremely proud of one of the most legendary youth academy graduates in our history."
The president of Real Madrid, Florentino Pérez, added: "Since he arrived at our youth academy as a child, Nacho has been an example to everyone and has earned the affection, recognition and admiration of everyone at Real Madrid.
"Real Madrid is and always will be his home."
Nacho paid tribute to Real Madrid fans with a message via social media.
"It has been months of reflection, indecision and doubt, but today I am here to tell you that I need to have a final and different experience along with my family and this is the perfect moment," he wrote. "Thank you Real Madrid for understanding me."