Ferrari's Felipe Massa considered ending his Formula 1 career in the midst of his struggles last season.
The Brazilian was off the pace of team-mate Fernando Alonso in the first half of the year but ended strongly, even outpacing the Spaniard occasionally.
Asked if he considered stopping, Massa said: "Yeah. I thought about so many things. I thought maybe I was finished. I thought about not staying in Ferrari.
"I did not know what would happen. So many things were inside my brain."
At mid-season, Ferrari were planning to drop Massa after seven years with the team but his revival in the second half of the championship convinced them to give him another year's contract.
Massa, who was talking in an exclusive BBC Sport interview, admitted he had worked with a sports psychologist as he sought to work out what was going wrong.
"I talked to everyone," said Massa, who narrowly lost out to Lewis Hamilton in a battle for the world title in 2008. "But I also did work with a professional psychologist, sporting psychologist.
"That was just the beginning. After that I was able to change the direction to think, the direction to work and I think it was like training I did. But also I think my family helps, definitely 100%."
He added: "The result is the most important thing. If you are able to show things change very quickly in F1, people who are sure you are finished they say different things after.
"Many people said I was just using fuel at the beginning of the year and then after they want me to stay in Ferrari because it was the best option. It is important to work to get the good result. If you have that nothing else is important."
The 31-year-old said he was confident he could retain his good form for the start of the 2013 season.
"I am very confident I can be in good shape," he said, "which I was [at the end of last year] even if it was not winning the race. But we did not have the car.
Massa said that Alonso was the best driver he had ever raced against - including Michael Schumacher, who was his team-mate at Ferrari in 2006.
"I think I had more difficult times with Fernando, so I would say Fernando was the strongest team-mate for me," Massa said. "You can even see in the numbers [statistics].
"But you learn with everybody. I learn a lot with Michael, with Kimi [Raikkonen in 2007-9] and Fernando."
Asked to confirm that he meant Alonso was the toughest ahead of Schumacher, he said: "Yeah."