Ten years ago this month, as he entered the sweltering second floor of an American Legion hall in Claremont, N.H., Sen. John McCain (R-Ariz.) was at the lowest point of his quest for the 2008 Republican presidential nomination. His campaign was broke, many on his staff were deserting him, and he was sliding in the polls. He was the longest of long shots.

That day he was doing what he always did in New Hampshire: taking questions from the public and offering responses that ranged from the humorous to the direct to the barbed. A man raised his hand, and McCain pointed to him. The man said he had voted for McCain in the state’s 2000 presidential primary. “You are an American hero,” he said.

Then the questioner adopted a less friendly tone. At a time when the Iraq War was deeply unpopular, he wanted to know whether McCain had become too close to his 2000 rival, President George W. Bush, and too supportive of Bush’s controversial troop surge — a policy McCain had advocated. And, the man asked, were all the commentators correct that weekend in calling McCain’s campaign a lost cause?

McCain removed his blazer and began with a customary quip. “I should have called on your wife,” he said with a chuckle that softened the audience. Then he turned serious, addressing the question of the future of his candidacy. “I’ve had tough times in my life,” he said. “This is a day at the beach compared to some others.”

[Five of John McCain’s most courageous political moments]

(Thomas Johnson/The Washington Post)

Like the quip, that comment was also typical McCain: resolute in the face of adversity while putting into proper context the hard knocks and setbacks of a political campaign as compared with the torture and injuries he endured for almost six years as a prisoner of war in North Vietnam.

As Steve Schmidt, a veteran Republican strategist who joined McCain’s camp later that summer, put it, “Being broke with everyone quitting and in last place in July of ’07, by orders of magnitude, may be a tragedy of dimensions not recoverable for the average politician. For John McCain, it was nothing.”

It was with that same combination of grit and humor that McCain responded last week to the news that he has an aggressive form of brain cancer. He tweeted, “I greatly appreciate the outpouring of support — unfortunately for my sparring partners in Congress, I’ll be back soon, so stand by.”

He was out hiking Saturday, according to his daughter Meghan McCain. “Amazing hike with Dad @SenJohnMcCain this morning. Thank you all for your best wishes!”she said in a tweet.

His experience as a POW is what first defined McCain’s life. It was not just that he survived the torture and multiple injuries after his plane was shot down in Vietnam in 1967. It was also the pride and defiance he showed in rejecting an early release proffered because his father was the commander of U.S. forces in the Pacific at the time. The decision left him in a prison camp from where he knew he might never emerge alive.

[What McCain learned from Ted Kennedy about challenging his own party]

He’s been called a hero and a maverick and a man of courage throughout his life. All are true. His fellow prisoners were the only ones who could see the true character of John McCain under the most inhuman conditions imaginable. The world at large could see a different example of his character under the most humbling of circumstances during those difficult days in 2007.

After his campaign imploded, he was completely written off. Reporters had but one line of questioning for him in those summer days: When was he going to quit the race? Why hadn’t he quit already?

Pollster Bill McInturff, who had been part of McCain’s core team, recalled the day that summer when some aides unwittingly played into the narrative of a campaign nearing its end. As rain threatened an outdoor event, McCain’s advance team had the bright idea to move across the street to an indoor venue. It was a funeral home.

McInturff said when reporters asked him why McCain was still in the race, he pointed past Vietnam to other evidence of his capacity for pain and risk. “I said forget the Vietnam stories,” he said. “If you don’t believe that, look at the fact that he was the boxing champion at Navy [the U.S. Naval Academy] at a time when there was no weight class. He was a combat pilot. . . . When he ran for Congress in 1981, he went to 25,000 doors for two years. It was 120 degrees in Arizona. He did it for three to five hours a day.”

McCain has been widely praised for his independence and willingness to take on presidents of his own party, including President Trump. He has been praised, too, for being known as a straight talker, and it was his Straight Talk Express bus tour in 1999 and early 2000 that made him a runaway winner over Bush in the New Hampshire primary.

[McCain escaped death twice as a Navy pilot and survived nearly six years as a POW]

There was one notable case, however, in which he shied away from straight talk. Advised by his team to avoid wading into the politically charged debate over whether South Carolina should take down the Confederate flag at its statehouse, he struggled to find the words. At points, McCain would pull a sheet of paper from his pocket and read a carefully scripted evasion of an answer.

He hated the deception, and after he lost the nomination to Bush, he returned to South Carolina to make amends for not saying forthrightly that the flag should come down.

“I did not do so for one reason alone,” he said. “I feared that if I answered honestly, I could not win the South Carolina primary. So I chose to compromise my principles. I broke my promise to always tell the truth.” He added, “Honesty is easy after the fact when my own interests are no longer involved.”

In the summer of 2007, McCain was honest with himself about his chances of winning but persevered nonetheless after a trip to Iraq just as his campaign was about to implode. McCain traveled to the country with his colleague and friend Sen. Lindsey O. Graham (R-S.C.). There he presided over a naturalization ceremony for soldiers who were immigrants. McCain was buoyed by the example of the young solider-immigrants.

“He had left [the] U.S. thinking he would drop out of the race, but decided if those guys could keep fighting so would he,” said Mark Salter, the co-author of McCain’s books and one of McCain’s closest confidants for many years.

Salter tells the story of his own equivocation during those days and the talking-to he received from his boss. “I was being a baby at one point and told him I thought I should quit the campaign,” Salter said in an email. “It was a day before the first trip to [New Hampshire], right after campaign shake-up. He sat me down in his office and said something like: ‘Tomorrow I’m going to New Hampshire. All the press are going to be there to see if I actually drop dead. We’re broke. They’re making fun of me. But I’m gonna work my [tail] off day after day. I’m gonna give it everything I got, and then I’m gonna lose. Why are you being such a wimp?’ ”

That day in Claremont in July 2007, McCain had told his audience, “I’m not a very good fundraiser. I’ll admit it. But I can out-campaign any of these guys, and I will, and I can, and we’ll do just fine.”

Just after Labor Day, he launched what he called the No Surrender tour. It was an all-out effort to defend the still-unpopular troop surge and to resurrect his candidacy. Neither seemed to come with good odds.

Rick Davis, McCain’s campaign manager and longtime adviser, said at the time, “I think there’s already been a stabilization. The question now is can we get a tick back up in these states?” McCain not only ticked back up. He out-campaigned all his rivals and won the nomination.

Today the odds may look long to others, but McCain has accepted his new diagnosis with that same indomitable spirit that has marked his life, the spirit encompassed in the words, “No Surrender.”