New Zealand great Dan Carter has announced his retirement from rugby at the age of 38.

The fly-half won two World Cups with the All Blacks and holds the record for the most Test points scored with 1,598, ahead of Jonny Wilkinson on 1,246.

The former Crusaders star, who also played for Perpignan and Racing 92 in France, has been playing for Kobelco Steelers in Japan and also turned out for the Blues in his homeland last year.

"I've thought about this on so many occasions but today is the day and I am very grateful that I can do it on my terms," Carter wrote on Instagram on Saturday.

"I'm officially retiring from professional rugby. A sport I've played for 32 years which has helped shape me into the person I am today.

"I can't thank everyone who has played a part in my journey enough – from my team-mates, opponents, coaching and management teams, sponsors and in particular you, the fans.

"A special mention to my friends and family who have supported and guided me through my career. Mum and Dad, thank you for everything you have sacrificed for me. My wife Honor for being my rock and allowing me to fulfil my dreams while raising our beautiful family – I can't thank you enough.

"I'm excited about my next chapter in life and what that will look like. For now, I'm sad to walk away from playing but the timing is right. Rugby will always be a part of my life. Thank you."

Speaking to the New Zealand Herald, Carter said "I knew in my mind the time was right" as the coronavirus pandemic made him consider whether he should keep playing abroad away from his family, with his fourth child on the way.

"After experiencing rugby in Japan I thought I could squeeze a few more years out of my body," he said. "There was something really enjoyable about being part of that environment and the culture we had at the Kobe Steelers. I was playing rugby and enjoying it and wasn't sure when I would stop.

"I got forced back by COVID in March and was gutted about that. I was coming off contract and I guess the frustrations of not being able to finish the Japanese season and then going to the Blues for a little bit, I loved that. I loved being part of the team environment but going through that process it made me realise that I play to be the best player out on the field.

"That is my drive and it always has been and I just didn't have that drive back here in New Zealand. When I realised the age my kids are and the amount of work Honor [Carter's wife] was doing looking after them while I was away chasing my dream, it made me realise it was time to stop."

Carter won three Super Rugby titles with the Crusaders and remains the leading scorer in the competition.

He won 112 caps for New Zealand, lifting the 2011 World Cup, although he missed much of the tournament due to a groin injury. He then led the All Blacks to defend their crown four years later with a man-of-the-match display in the final against Australia.

Former England coach Clive Woodward described Carter's performance against the British and Irish Lions in a Wellington Test in 2005 as "off the Richter scale" and "possibly the best individual performance I have ever witnessed at Test level".