Xabi Alonso has announced he will retire from playing at the end of the season. 

Alongside a picture of him waving, Alonso wrote on his Twitter account: “Lived it. Loved it. Farewell beautiful game.”

Alonso started his career with Real Sociedad before playing for Liverpool, Real Madrid and Bayern Munich.

“It wasn’t an easy decision to make, but I believe it’s the right time. I always thought it would be better to quit sooner rather than later. I still feel good, but I believe this is the right moment.

“I wanted to end my career still at the highest level, and Bayern is the highest level. I’m incredibly proud and happy to play for FC Bayern and to be a part of this family.

“I’ve experienced so much as a player with Real Sociedad, Liverpool, Real Madrid and Bayern Munich. They are all great clubs. And of course, with the Spanish national team. I never would’ve thought I’d have such a great career, and I hope there’s more to come before it ends.”

Bayern chairman Karl-Heinz Rummenigge hailed Alonso as one of the game’s greats and a “gentleman of football”. Rummenigge said: “Bayern would like to thank a great player and person for representing Bayern to such a high standard both on and off the pitch.

“Xabi Alonso is one of the greats of world football. He has won everything there is to win during his career. He’s a thoroughly remarkable person, and a gentleman of the game.”