The former Real Madrid defender said in a social media video: "To you guys, Manchester United supporters. It's been fantastic years playing for this special club and wearing this shirt.
"The first time I went to Old Trafford as a Manchester United player it was crazy. The atmosphere was fantastic. I fell in love with the club, with the Manchester United fans, understanding what it represents for my children, it will be a special place for me, for a lifetime all my life.
"Sharing that moment with them was absolutely fantastic. Even though we have had a difficult season, I am very optimistic for the future. The new owners have arrived with a clear plan and a great strategy.
"I will wait for you at Old Trafford to say goodbye, for the last home game of this season and it will certainly be a very emotional day for me."