AP McCoy, the 19-times champion jump jockey, has announced he will retire by the end of the season.
McCoy, 40, revealed the news after claiming his 200th winner of the season on Mr Mole in the Betfair Price Rush Chase at Newbury.
"I want to go while I'm still enjoying racing and while I am still near the top," he told Channel 4 Racing.
"This is without a doubt the hardest decision I've ever had to make. I've been dreading this day."
McCoy, from County Antrim, Northern Ireland, had just moved to a career tally of 4,322 winners when he gave his immediate post-race interview. Still riding Mr Mole, he announced his retirement live on television.
|Profile of AP McCoy|
|Click here to see his career in pictures|
He was the first jockey to win the BBC Sports Personality of the Year award in 2010 after he won the Grand National for the first time at his 15th attempt, aboard Don't Push It.
McCoy has been champion jockey every season since 1996 - his first year as a professional.
He came to his decision after speaking to his agent, Dave Roberts, and owner JP McManus, for whom he has ridden for the last 10 years.
Despite planning to stop within a few months, McCoy admitted he "still can't quite imagine a life without racing".
He added: "However, I know it's the right time to end a career I've loved.
"Even when I've fallen and been injured, I've been desperate to get back and achieve my goals, achieve the dream I realised when I was a boy, but I'm now ready to retire.
"I want to finish my career as champion jockey, and I want to finish on a win. I don't know when that will be exactly, but 20 championship titles is a nice even number.
Trainer Paul Nicholls said: "He's been such a legend but you can't go on for ever. He's riding as well as he ever has so that's probably the right time to go out. He's been a great ambassador. Everyone will miss him, won't they?"
Rival jockey Richard Johnson said: "Even though we all know we're getting to that point at some point, it's still a shock. Look, he's been amazing and his memories will last for a long long time."
Trainer Martin Pipe, who was McCoy's boss for seven years from 1997, added: "He's been an absolute legend for horse racing and will never be surpassed again in anybody's lifetime."
|BBC Sport horse racing correspondent Cornelius Lysaght:|
|"It was widely assumed McCoy would retire soon, but no one guessed the announcement would come now. He's looked as imperious as ever since returning from an injury-enforced absence in the autumn. "It's clear the decision has been a highly-emotional one for the man himself; after all, being champion jockey has been his life since the mid-1990s.All these years, he's produced an extraordinary work-rate, has juggled the success brilliantly with the obvious injury perils involved and, above all, has demonstrated that McCoy magic which made horses want to go faster. The chasm he leaves behind will surely never be filled. "|
McCoy's wife, Chanelle, said he made the decision two weeks ago. "Some days he's at peace with it, some days he's a little bit sad," she said.
"Hopefully he'll be 20 years champion jockey this year and will go out on a high."
McCoy's revelation overshadowed the return to racing of 2014 Queen Mother Champion Chase winner Sire De Grugy, who suffered a serious hip injury last April.
His comeback in the Betfair Price Rush Chase did not go as planned, though, and after stumbling on the fourth-last jump, he unseated jockey Jamie Moore at the next fence.