In Philadelphia, the National Constitution Center awarded Mr. McCain its Liberty Medal, honoring his lifetime of public service. The senator’s acceptance speech was a treatise on his expansive view of America’s role in the world — a role that, he fears, is being diminished by Mr. Trump’s leadership.
“The international order we helped build from the ashes of world war, and that we defend to this day, has liberated more people from tyranny and poverty than ever before in history,” Mr. McCain said.
He went on to deplore as “unpatriotic” those who would “abandon the ideals we have advanced around the globe,” in favor of “some half-baked, spurious nationalism cooked up by people who would rather find scapegoats than solve problems.”
The speech grew out of a book Mr. McCain is writing with Mark Salter, his longtime speechwriter and co-author. It was not aimed directly at Mr. Trump, Mr. Salter said, but at the philosophy of Stephen K. Bannon, Mr. Trump’s former chief strategist, and his hard-charging right-wing website, Breitbart News.
“In my view, and McCain’s too, these guys at Breitbart are crackpots,” Mr. Salter said.
Another element of the speech — Mr. McCain’s gratitude for a life well lived — was equally important to the senator, Mr. Salter added, but it got lost in the media frenzy around the address.
Mr. Biden said he took the speech as a pointed message, if not to Mr. Trump, then to the nation. “I think he was delivering a message to the country, to his colleagues and to any of the opinion makers that would listen, and that is, ‘Look, this is serious stuff, our role in the world is not guaranteed, democracy is not guaranteed, we know how to do this and, damn it, we’d better focus and know what’s at stake.’”
The president, though, took it personally.
“People have to be careful, because at some point, I fight back,” Mr. Trump said in a radio interview with WMAL in Washington. “I’m being nice. I’m being very, very nice. But at some point, I fight back, and it won’t be pretty.”
To which Mr. McCain, a former Navy captain who was tortured during more than five years as a prisoner in Vietnam, shot back: “I have faced tougher adversaries.”
Mr. Biden found the tit-for-tat laughable. “The idea that Trump is going to intimidate John McCain? Give me a break,” he said.
Mr. McCain, who was the Republican nominee for president in 2008, has never been a fan of Mr. Trump, who once derisively referred to the senator’s time as a prisoner of war by saying, “I like people who weren’t captured.” During the 2016 presidential campaign, Mr. McCain at first grudgingly supported Mr. Trump, and then revoked his endorsement after the release of an “Access Hollywood” tape in which Mr. Trump boasted that he had sexually assaulted women.
Credit The New York Times
Now, “there’s not a relationship” between the two men, said John Weaver, a Republican strategist who is close to Mr. McCain. “It’s not like they had one that got soured, or they had one that has not improved. There is not one.”
In a brief hallway conversation in a Capitol corridor this past week, Mr. McCain put it this way: “I’m doing what I think is right for the country. I don’t work for Donald Trump, and I don’t work for his administration.”
He has turned his tongue on his colleagues as well. In July, in a dramatic return to Congress after surgery to remove a blood clot above his left eye, he delivered a harsh critique of the Senate as he called for Democrats and Republicans to work together.
“We’ve been spinning our wheels on too many important issues, because we keep trying to find a way to win without help from across the aisle,” Mr. McCain said.
That speech was “the kind of speech one gives when they’re leaving,” said Senator Patrick J. Leahy, Democrat of Vermont, who has served for decades in the Senate with Mr. McCain. “I think in many ways it was a catharsis for him, and I think that he doesn’t know how much longer he has. I hope he has a long, long time. But I think he’s decided, I’m going to make every moment count.”
If Mr. McCain views himself as a guardian of the Senate as an institution, it is perhaps because he practically grew up in the chamber.
In 1977, four years after his release from the Vietnamese prison known as the Hanoi Hilton, the Navy assigned Mr. McCain to be its Senate liaison. He traveled around the world with lawmakers — including Mr. Biden, then a senator from Delaware — arranging their schedules and sometimes even carting their luggage.
He was elected in 1982 to the House and in 1986 to the Senate, where he now has the only job he ever wanted other than president: chairman of the Senate Armed Services Committee.
Today, he is one of the few Republicans who regularly crosses the aisle, on matters ranging from immigration to health care. In July, he cast the final vote — a dramatic thumbs down — as a bill to repeal the Affordable Care Act was defeated.
The reaction to his health care vote “surprised him,” Mr. Biden said, “how much impact it had in giving courage to others of his own party.”
Last week, Mr. McCain joined Senator Ben Cardin, Democrat of Maryland, in scolding the Trump administration for missing a deadline to impose sanctions on Russia, intended as punishment for Russia’s tampering with the 2016 presidential election.
And on Wednesday, he became the first Republican to sign on to legislation that would force Facebook, Google and other internet companies to disclose who is purchasing online advertising, another acknowledgment of Russia’s role in the 2016 campaign. Senator Amy Klobuchar, the Minnesota Democrat and chief sponsor of the measure, sees Mr. McCain expanding his reach.
“I think he’s speaking out on much broader issues,” she said.
As he walks the halls of the Capitol, often surrounded by reporters — he once famously referred to the news media as “my base” — Mr. McCain is his usual irreverent, prickly self. To a reporter who missed his speech in July, he said wryly: “It was one of the great speeches ever given. People thought about William Jennings Bryan when they saw that speech.”
When a Fox News correspondent asked if he would oppose everything Mr. Trump asked him to do, the senator snapped, “Why would you say something that stupid?”
Ask how he is feeling, and he will issue a brusque reply — “fine, fine, I’m fine” — before brushing aside further inquiry. But he has grown thinner in recent weeks, and sometimes looks fatigued. Those who know him well see the cancer treatment wearing on him. He is characteristically matter-of-fact about the future.
As he said on CNN last month, “Every life has to end one way or another.”