Middlesex batsman Nick Compton has announced his retirement from cricket.

The 35-year-old joined the club from Harrow School and made his first-class debut in 2004, following in the footsteps of grandfather Denis, who played the first of his 515 first-class matches for the county in 1936.

South African-born Compton went on to play 16 Test matches for England, scoring two centuries, and appeared in 402 first-class matches for Middlesex, helping them win the county championship title in 2016.

He told the club website: “After almost two decades of professional cricket I am announcing my retirement from the game I love so much.

“It has been a privilege to play first-class cricket for Middlesex, Somerset, and the MCC.

“Of course, the pinnacle of my career was following in my grandfather Denis Compton’s footsteps, having achieved my dream of playing and winning Test series for England.

“I am particularly proud of my successful opening partnership with Alastair Cook and our series victory in India, the first time in 28 years an England team has won in India.

“There have been some challenges that I have had to confront, but in spite of these I feel incredibly fortunate to have had this career of mine. For one, being named one of Wisden’s 5 Cricketers of the Year in the 150th Anniversary Edition alongside both my cricketing hero Jacques Kallis, and my school friend Hashim Amla.

“Other highlights include being chosen as PCA Player of the Year by my peers after coming so close to being the first cricketer for 25 years to score 1,000 runs before the end of May is another, up there with making my Test debut in India and receiving my cap from England legend Graham Gooch.

“I treasure the 16 Test matches I played for England, especially my back-to-back Test hundreds which I scored in New Zealand. On the domestic front, what a team I played in at Somerset. And winning the County Championship at Lord’s on the final day of the 2016 season for Middlesex provided all involved with an experience that we will savour for the rest of our lives.

“It seems fitting that I have decided to retire now - 2018 is the year which my club, Middlesex, awarded me a Testimonial Year. It is also my grandfather’s centenary and it gives me huge pride in being able to pay tribute to someone that has left such a positive legacy in my life and in British sport.

“I am delighted that I will be continuing my association with Middlesex Cricket in an ambassadorial capacity, both at Lord’s and in India – a country which is close to my heart. By remaining connected to cricket, I hope to continue developing and mentoring young cricketers, especially those who have a desire to excel.

“I look forward to pursuing my other interests, particularly in the media and photography as well as working on a few business ventures.

“Finally, I would like to take this opportunity to thank my family especially, and also my ‘inner circle’, for the support they have given me. I hope I did all I could to keep the Compton Family flag flying.”

Middlesex Cricket’s chief executive officer Richard Goatley added: “It is a sad day for us that Nick Compton has retired from professional cricket. Nick has been a very special servant to the club, culminating in his key role in the Championship-winning success of 2016.

“Nick is highly valued by Middlesex Cricket and we are delighted that he will remain with the club in an ambassadorial role. We welcome his all-round ability, and want him to add further value by helping to inspire our future success in an off the field capacity.

“He has contributed effectively towards the club’s off-field work in the past, both with our senior leadership team and the commercial team at Lord’s, and we look forward to extending that work in the future.

“Nick Compton will always be welcome at Lord’s.”

News of Compton’s retirement comes after it had also been revealed that James Fuller had left to join Hampshire.

The all-rounder turned down the offer of a new contract at Lord’s after scoring 714 runs and taking 75 wickets in three seasons with the club, despite an elbow injury in 2017.

He told the club website: “I want to thank Middlesex Cricket for the opportunity to play at the Home of Cricket.

“Never in my wildest dreams did I think growing up in New Zealand I would call Lord’s my home ground. I have so many fond memories of my last three years here at Lord’s - none more so then when the side won the County Championship in 2016.

“I came to Middlesex to get better as a player and to challenge myself and I would like to thank all the coaches for their efforts and insights to make that happen.

“I would also like to thank Angus Fraser for his unwavering support during 2017 when I was side-lined with an elbow injury. With that I would also like to thank the medical support team, Pete Waxman and Dave Bartlett for their efforts to get me back playing cricket.

“I would also like to thank all the back-room staff who have become great friends and have added to what is already a great club.

“I have thoroughly enjoyed contributing to the second half of the season this year and I will deeply miss all the guys in the dressing room. It is a great team filled with great blokes, who I wish all the very best for the future.”