WASHINGTON (AP) -- John McCain couldn't bring himself to vote for Donald Trump — so he talked about writing in his best friend's name for president. After the election, he's been the leading Senate Republican critic of Trump's posture toward Russia. And from his Arizona home, where he's battling brain cancer, the Arizona senator on Thursday lobbed a new attack at the White House over its Syria policy.

The grave medical diagnosis hit the six-term senator just as he was settling into the latest notable role in his storied career. The ex-prisoner of war, former GOP presidential nominee and onetime standard-bearer of the political Straight Talk Express has emerged as a voice for what some Republicans feel is a party lost in the Trump era. He's lambasted Trump as a defamer of military personnel, recoiled from Trump's willingness to cozy up to Russian President Vladimir Putin and rejected Trump's self-described boorishness toward women.

On Thursday, less than 24 hours after announcing he'd be undergoing treatment for glioblastoma, McCain promised — warned, really — that he won't be gone for long.

"He is yelling at me to buck up so I'm gonna buck up," said Sen. Lindsey Graham of South Carolina, McCain's close friend in the Senate.

It was classic McCain, whose candor offers a dose of authenticity and moxie at a time when his fellow Republicans control Congress and the presidency but are struggling to govern. His absence, however long, raises the prospect of a Senate without its sometimes trash-talking, yet also self-effacing, senator from Arizona for the first time in more than three decades. In the short term, McCain's treatment deprives Senate Republicans of a vote they need for a controversial health care rewrite in the narrowly divided chamber.

After audio surfaced in October of Trump talking about groping women, McCain broke with the candidate and said he'd write in Graham's name on Election Day. When Trump won, he called for a special committee to investigate Russian meddling in the election, recently lamenting that the Russia issue is "a challenge to Washington, D.C., the way we do business, a challenge to bipartisanship and a challenge to the effectiveness of this newly elected president."

Story continues

McCain, chairman of the Armed Services Committee, says he received sensitive information last year and turned it over to the FBI, an apparent reference to an unsubstantiated report that Russia had compromising personal and financial information about Trump.

On Thursday, from his home in Arizona, McCain said the administration would be "playing right into the hands of Vladimir Putin" if, as The Washington Post reported, Trump was ending a program to back the Syrian opposition. Graham said McCain had called him three times Thursday on immigration legislation.

"I think John is a force that is unique to him. He has done things that most people could not do," said Graham. "Going forward he's excited, quite frankly, about getting a second chance to finish things that have been stuck."

Yet for all of his confrontational style, McCain has voted with Trump most of the time. He voted in favor of most of the president's Cabinet nominees and with Trump against several Obama-era regulations.

Longtime colleagues, even those McCain has called names, say he developed his fearlessness as a navy aviator held as a prisoner for more than five years in Vietnam. Resilience, they say, has fueled his long Senate career and helped him overcome two failed presidential campaigns. For some, McCain has become the moral voice of the Republican Party, whose leaders have not always said out loud what they really think about Trump.

"He's not afraid of anybody or anything, clearly," said Texas Sen. John Cornyn, a Republican at whom McCain shouted, "F--- you!" in 2007. "He's unique, to say the least."

"He does everything to make sure he's heard," said GOP Sen. Chuck Grassley of Iowa, whom McCain has called "a f------ jerk." ''When he disagrees with people he's going to tell them he disagrees."

He's been known to apologize after some of his more colorful outbursts.

Sen. Roy Blunt, R-Mo., said pushing back against the administration only rarely requires a public challenge of the president.

"But I think John McCain figured out that his personality and his history let him do that," Blunt said "That irascibility helps keep everybody else moving in the right direction."

McCain's relationship with Trump has long been testy, dating back at least to Trump's declaration two years ago that McCain was not a war hero by virtue of having been captured. McCain said Trump owed other veterans an apology for that.

The Arizona senator emerged early in the Trump administration as the new president's nemesis, breaking with Trump on his immigration order, warning him against any rapprochement with Moscow, lecturing him on the illegality of torture and supplying only a lukewarm endorsement of Rex Tillerson, Trump's choice for secretary of state.

"Clearly, in the Republican Party he has been completely unafraid to tell his own party when he thinks they're wrong," said McCain friend Steve Duprey.

McCain has long given policy-watchers whiplash.

He snarled about the Obama administration's handling of the deadly assault in Benghazi, Libya and ripped into former Defense Secretary Chuck Hagel over the Iraq war.

But he also has tried to revive his past bipartisan effort on immigration, at one point reaching out to Obama, the man who beat him for the presidency in 2008.

On Thursday, McCain warned his colleagues, and Trump, not to get too comfortable in his absence.

He tweeted from afar: "I'll be back soon, so stand-by!"

___

AP Writers Andrew Taylor, Astrid Galvan and Steve Peoples contributed to this report.

___

Follow Kellman at http://www.twitter.com/APLaurieKellman