Pepe confirmed he will leave Real Madrid this summer.

Pepe had hoped to remain with Real Madrid but instead voiced his displeasure with how he was treated over the final few months of his stay.

"Today I can only thank all those who have supported me -- who, with me, have written such a lovely story. Thanks to my friends and teammates, who I know will stay with me wherever I go.

"I feel very happy with what I have achieved and will carry your kind feelings in my heart. To step out at the Santiago Bernabeu and feel your support was always magic."

Pepe said he understood Madrid had a policy on contract offers to older players, but said he was frustrated by the club's response when he became embroiled in a dispute with the tax office.

"They offered me a one-year deal," he said. "They do not give two years to players over 33.

"There are ways of talking and negotiating. Real Madrid's behaviour has not been correct.

"The club did not defend me with the tax issue. They knew I was up to date and had no problem. That hurt me, as I always fulfilled my obligations, and they made me understand I was not valued."