The former Juventus, Milan and Italy midfielder Andrea Pirlo has announced his retirement from football at the age of 38.

Pirlo, who won the World Cup with Italy in 2006, has called time on an illustrious playing career after his current team, New York City FC, were knocked out of the MLS play-offs.

“Last match in MLS. As my time in NYC FC comes to an end, I want to thank everybody for the kindness and support they have shown me in this incredible city,” Pirlo tweeted.

“Not only my adventure in New York comes to an end but my journey as a football player as well. Thank you to the amazing supporters, thank you to the coaching staff … and thank you to my team-mates.”

Pirlo began his career at Brescia before joining Inter for £1.8m in 1998. The midfielder failed to hold down a regular starting place, and moved to Milan for £16m in 2001. In a decade with the rossoneri, Pirlo played 400 games, winning two Serie A titles and the Champions League in 2003 and 2007.

In 2011, days after his 32nd birthday and with his Milan contract set to expire, Pirlo made a surprise move to Juventus. Playing in a deeper role under Antonio Conte and Max Allegri, he won another four league titles, played in the 2015 Champions League final and cemented his reputation as one of the world’s most elegant, technically gifted midfielders.

Pirlo moved to New York City FC in July 2015, playing for the MLS side for two seasons. In October, he announced that he would retire at the end of the season, but denied rumours that he would link up with Conte again as part of the Chelsea coaching staff.

“You realise yourself that the time has come. Each day, you have physical problems and you can’t train as you would like to. At my age, it’s fine to say enough is enough,” he told Gazzetta dello Sport.

“I would like to thank my family and my children for the support and love they always give me, every team that I had the honour to play for, every team-mate I have been pleased to play alongside,” Pirlo added in Monday’s statement.

“Last but not least, all the fans around the world that always showed me support. You will always be on my side and in my heart.”

Pirlo came off the bench in the final minute as New York City FC were eliminated from the MLS play-offs by Columbus Crew. Patrick Vieira’s side won 2-0 at Yankee Stadium but lost 4-3 on aggregate to Columbus, bringing their season to an end.