Portugal international Pepe has signed for Besiktas, the Turkish champions announced on Tuesday, bringing to an end 10 incident-packed years with Spanish giants Real Madrid.
The 34-year-old Brazilian-born defender joined Real from Porto in 2007 for 30 million euros ($34.05 million), winning the Liga title in his first campaign.
His contract with Real expired last month and, according to reports in the Turkish media, he will sign a two-year contract with Besiktas.
He leaves Real after winning three La Liga titles, two King's Cup trophies and following three Champions League triumphs, although he missed this year's European Cup final victory against Juventus due to injury.
Pepe gained infamy in his second campaign in Spain for kicking out at Getafe's Javier Casquero after fouling him and punching Juan Albin in a game in April 2009, earning a 10-game ban, and later said he had "lost control".
He was sent off four times for Real, including a red card for a lunge on Barcelona's Dani Alves in a Champions League semi-final first leg in 2011, but will be fondly remembered by the Madrid club's fans for his spirited performances and consistent partnership with Sergio Ramos.
Pepe has made 86 appearances for Portugal and was named Man of the Match in the Euro 2016 final win over France.
He scored an added time equaliser in Sunday's Confederations Cup third place playoff game against Mexico to send it into extra time in which the European champions won 2-1.
($1 = 0.8810 euros)