Michael Schumacher has announced that he will retire from Formula 1 at the end of the season.
McLaren's Lewis Hamilton is to replace the seven-time world champion at Mercedes from next year.
for 2013 but has decided to end an F1 career that began in 1991.
"Although I am still able to compete with the best drivers, at some point it is good to say goodbye," said the 43-year-old German.
"During the past month, I was not sure if I still had the motivation and energy which is necessary to go on. It is not my style to do something that I'm not 100% for.
"With today's decision, I feel released from those doubts. In the end, my ambition to fight for victories and the pleasure of driving is nourished by competitiveness."
Schumacher won 91 races in 19 seasons, helping to revive Ferrari's fortunes after he joined them in 1996.
He won his first title with Benetton in 1994 and repeated the feat the following year, before leaving for Ferrari. He claimed five straight titles between 2000 and 2004, before retiring for a first time in 2006.
After three years away from the sport, he made a comeback with Mercedes in 2010. However, he has managed just one podium finish in three seasons, in June.
"We did not achieve our goals to develop a world championship-fighting car, but it is also very clear that I can still be very happy about my overall achievements in the whole time of my career," added Schumacher.
"In the past six years, I have learned a lot about myself. For example, that you can open yourself without losing focus, that losing can be both more difficult and more instructive than winning.
"Sometimes I lost this in the earlier years, though you appreciate what you are able to do and that you are able to live your convictions and I was able to do so."
Speculation that Schumacher would retire at the end of the season first surfaced at the start of September, when Formula 1 boss Bernie Ecclestone told BBC Sport that the German was quitting the sport.
Schumacher insisted on Tuesday he remained motivated for Sunday's Japanese Grand Prix, where he will drop 10 places on the Suzuka grid after being penalised for crashing into the back of Jean-Eric Vergne's Toro Rosso during the Singapore Grand Prix.
However, he admitted Hamilton's move to Mercedes helped him decide to retire.
"I was in the picture when the negotiation was going on, but I didn't want to decide, I was not sure," said Schumacher.
"Sometimes in life your destiny will develop by itself, without any hard feelings and without any regrets.
"We all know Lewis is one of the best drivers we have around and I cross fingers that we will have a successful future."
Schumacher would not be drawn on what he plans to do after the season ends, saying his focus is on the remaining races.
"There are six races to go, that's what comes next," he said. "Whatever comes afterwards, we'll see.
"I have options - and you know some of the options - but we will decide when the time is there."
Mercedes team principal Ross Brawn has already suggested there may be a position for Schumacher with the German manufacturer.
"We would like him to stay involved with Mercedes," Brawn told BBC Sport last week.
"There is a lot of things he can contribute - perhaps on the racing car side but certainly on the road car side - and I think that is something he would enjoy a great deal."