Portugal defender Pepe has returned to Porto on a deal until 2021 following his release by Besiktas, the Primeira Liga club have confirmed.
Pepe played for Porto between 2004 and 2007 before being snapped up by Real Madrid, whom he represented for a decade.
The most successful days of his career were at the Santiago Bernabeu, winning both the Champions League and La Liga three times.
He joined Besiktas in 2017 and was well-regarded by supporters, but he opted to agree to a mutual termination of his contract towards the end of last year in a bid to help the club's worsening financial woes.