WASHINGTON — Sen. John McCain insists he's a supporter of President Donald Trump, even as he has once again emerged as his biggest Republican foe on Capitol Hill.

That's a major problem for Republicans scrambling to hold together their party and advance an ambitious slate of new defense policies, including a massive military buildup that both men say they want.

The Senate Armed Services Committee chairman, a former Navy prisoner of war and his party's most prominent Republican voice on defense, helped shepherd Trump's pick for defense secretary through a complicated Capitol Hill process. He has voted for every one of his Cabinet selections. He has called Trump's pledges to fight terrorism a critical move away from what he considers failed policies of former President Barack Obama.

"I support his commitment to rebuilding our military, there are a whole lot of things I've said positive about this administration," the 80-year-old Arizona senator said when asked recently about his feelings about Trump.

But he also publicly sparred with Trump throughout the presidential campaign and since his election win, and the acrimony hasn't slowed down since Inauguration Day.

In the first 21 days of Trump’s presidency, McCain refuted Trump’s comment that the U.S. and Russia are morally equivalent, slammed his pick for budget director over his votes to cut defense spending, and rebuked the president’s openness to enhanced interrogation techniques.

"I don’t give a damn what the president of the United States wants to do," McCain boldly told reporters. "We will not torture … The law is the law."

Trump himself went after McCain this week after the senior senator questioned the White House’s use of the word "success" to describe a special forces raid in Yemen that resulted in the death of a Navy SEAL and several civilians.

"Sen. McCain should not be talking about the success or failure of a mission to the media. Only emboldens the enemy!" Trump wrote in a series of tweets. "He's been losing so long he doesn't know how to win anymore …

"Our hero [Chief Special Warfare Operator William "Ryan" Owens] died on a winning mission according to [Defense Secretary] General [Jim] Mattis, not a ‘failure.’"

McCain bristled at White House assertions that his comments amounted to disrespect for the fallen SEAL, telling NBC News that as a prisoner of war, he understands the gravity of military missions more than the White House officials criticizing him.

The fight harkened back to the earliest days of Trump’s presidential campaign, when he famously denigrated McCain’s status as a Vietnam war hero and prisoner of war. Even as Trump’s political stock rose, McCain offered only a tepid endorsement of the Republican nominee and revoked it after audio surfaced of Trump making lewd comments about women.

Earlier this month, after McCain called Australia’s U.S. ambassador to clean up after Trump’s testy call with its prime minister, a source close to McCain confided the SASC chairman does not relish his oppositional role and would rather not have to relitigate U.S. alliances long part of the nation's status quo.

Answering questions about Trump — and cleaning up after his controversial moves — is not how McCain, who has quarterbacked significant Pentagon reforms in recent years, wants to spend his remaining years in the Senate.

So far most of the opposition to Trump has been vocal and not legislative. But on Wednesday, he joined Sen. Lindsey Graham, R-S.C.; Sen. Marco Rubio, R-Fla., and three Democratic sponsors of a bill to establish veto power over Trump if he decides to weaken U.S. sanctions on Russia.

It was McCain’s latest move to steer Trump away from mending diplomatic ties with Russian President Vladimir Putin, a frequent target of the senator’s ire.

"Easing sanctions on Russia would send the wrong message as Vladimir Putin continues to oppress his citizens, murder his political opponents, invade his neighbors, threaten America’s allies, and attempt to undermine our elections," McCain said.

But whether the feud between Trump and McCain will amount to a full legislative impasse remains unclear.

As the gatekeeper for all things defense in the Senate, McCain has the power to slow Trump’s Pentagon nominations, rewrite his budget priorities and enact restrictions on a host of foreign policy moves.

And McCain’s Pentagon reform goals — which in past years have included an overhaul of the military acquisition, health care and retirement systems — are unlikely to get much traction without the president and his defense team.

For now, Senate Republican leadership has largely stayed away from the growing squabbles, with Senate Majority Leader Mitch McConnell, R-Ky., avoiding direct responses to most of Trump’s pointed comments.

But McCain is seeing support from Democrats on his committee, who already have spent the first month of Trump’s presidency lamenting a host of controversial foreign policy moves.

"That’s a dangerous area for President Trump, to continue to trash John McCain," warned Sen. Bill Nelson, D-Fla. "When President Trump assaults Sen. McCain, he better watch out because this is a guy who knows what he’s talking about and not only has he walked his talk, he has been there."

Committee ranking member Sen. Jack Reed, D-R.I., praised McCain as "unflinching" in his service and commitment to troops.

"It goes to the unique circumstances of someone who has served in combat courageously, who was a prisoner of war, who came back and never forgot the young men and women who serve today," said the former Army Ranger.

Sen. Claire McCaskill, a member of the committee and the Senate Homeland Security Committee's ranking member, said at a time when other Republicans are "whispering" dissent, McCain has the "guts and courage to speak out against a guy who's going after him on Twitter."

"I'm proud to serve with him and I think he's doing a great job of speaking his mind," said McCaskill, D-Mo.