American Mardy Fish brought his career to an end with a stirring five-set contest against 18th seed Feliciano Lopez at the US Open.
The 33-year-old was struggling with fatigue and cramp as he lost 2-6 6-3 1-6 7-5 6-3 in New York.
Fish, whose ranking has slipped to 581, has played only four matches this season, his first since 2013 after suffering with severe anxiety.
"You can beat it," said the former US number one after his final match.
Fish outlined his downward spiral in a piece on The Players' Tribune this week, describing how he "became consumed by this exhausting, confusing dread. And the attacks just kept … getting … worse".
"It's always going to be part of your life but you can put yourself back in the fire and it will be OK. I think I showed that here at this tournament," added the former world number seven.
'I can't play - I literally can't play'
At the age of 30, Fish had broken into the world's top 10 and overtaken Andy Roddick to become the American number one when the anxiety attacks started in 2012.
Heart problems, sleeplessness and fear of being alone had begun to dominate life off the court, and a first and only anxiety attack on court came during a US Open night match against Gilles Simon.
His next match was due to be a fourth-round meeting with Roger Federer.
"I can't do it," thought Fish. "I literally can't do it.
"We were in the car, driving to my next match against Roger - and my thoughts were filling with dread. Would it happen on the court again?"
Convinced by his wife to pull out, Fish would not return to the court in 2012, played just 10 matches in 2013 and none in 2014.
"There is a reason why I didn't retire," he said. "Because I figured deep down I wanted to go out on my own terms."
|Mardy Fish in numbers|
|2000 - Turned professional||302 matches won, 291 matches lost|
|7 - The American's highest ranking (581 current ranking)||6 - ATP titles and $7.4m in prize money|
'They'd have to carry me off the court'
Fish finally announced at the beginning of the summer that he would end his playing days after his 13th and final US Open, and has since spoken openly about his condition.
"There are tens of millions of Americans that deal with it on a daily basis," he said. "I've gotten to the point where I want to share my story so I can help."
He had only made it into the tournament using a protected ranking for players who have been absent through illness or injury.
To beat world number 106, Marco Cecchinato, in the first round was quite an achievement, and to serve for the match against Lopez was remarkable.
It was no surprise that Fish eventually succumbed to the soaring temperatures in a fifth set - but he was not about to join the growing list of players to quit on court.
"They would have had to carry me off the court," he said. "I was definitely not stopping at that point.
"I accomplished everything that I set out to this summer and I'm happy about that."
|Venue: Flushing Meadows, New York; Dates: 31 August-13 September|
|Coverage: Live radio and text commentary on every Andy Murray match plus selected matches.|