New York: Mardy Fish faced down heart problems and crippling anxiety attacks, but in the end it was a humble spot of cramp that brought his career to an end on Wednesday.

The 33-year-old American, who has played just a handful of tournaments in the last three years and seen his ranking slip to 581 as he battled his personal demons, had already said that this US Open, his 13th, would be his last event.

Despite serving for the match at 5-4 in the fourth set of his second round clash against Spain’s Feliciano Lopez, he was finally undone by the same cramping that has claimed many players at this year’s hot and humid US Open.

“I wasn’t quitting. I was just cramping. I mean, both sides of both legs, if I moved anywhere close to three or four steps, two or three steps, it would go,” said Fish after the 3hr 11min Louis Armstrong Stadium encounter, which he lost 2-6, 6-3, 1-6, 7-5, 6-3.

“You would have had to carry me off the court. I was definitely not stopping at that point.”

Fish once reached number seven in the world, won six career titles and made the quarter-finals three times at the majors, including the 2008 US Open.

But, in 2012, his world imploded. In May that year, he underwent a procedure to correct a heartbeat irregularity.

Then, at the US Open, where he was the 23rd seed, he was set to face Roger Federer in the fourth round but stunned the tournament by withdrawing for “health reasons”.

It was then that Fish realised he was dealing with a problem that affects millions of people around the world. He suffered another anxiety attack sitting on the plane that was to carry him home to Los Angeles as it taxied on the runway.

Fish had to disembark and pay $20,000 (Dh73,439) to hire a private jet to take him out of New York.

The Anxiety Disorders Association of America estimates that 3.3 million Americans over the age of 18 — around 1.5 per cent of the population — suffer from the disorder every year. The condition decimated Fish’s career.

This year’s US Open was his first since that 2012 pullout. He played just five events in 2013, none at all in 2014 and this year featured in only three tournaments, all in the United States.

He hopes his legacy will be one of lifting the stigma — especially for men — that surrounds the problem of anxiety and show that it is a genuine medical condition.

“I was open and honest about a topic that is not supposed to be masculine,” he said.

“We are trained as tennis players from a very young age to not show weakness. I was very good at that throughout my career.

“I want to help people that have gone through it and try to be a role model for people that are deep into some bad times, that they can get out of it, because I was there. They can conquer it.”

Lopez, a fellow 33-year-old who first played Fish back in 2002, was generous in his praise of the American.

“He was the better player and deserved to win this match. I was very lucky,” said Lopez.

“It’s very sad what has happened to him with his illness in recent years. We played many times and he was often the better player.”

One of the first ex-players to congratulate Fish on his career was compatriot and former US Open champion Andy Roddick.

“@MardyFish hell of an effort my friend... I couldn’t be prouder,” tweeted Roddick.