WASHINGTON — When it comes to safeguarding the honor and dignity of those who have served, there is no one in Congress that veterans put more stock in than Vietnam War hero John McCain.

But when it comes to questions of how to structure and pay for veterans' benefits such as health care, McCain and veterans advocacy organizations are at odds at least as often as they are in lock step.

McCain's is a mixed bag of a legislative record that in any other circumstance might be unremarkable. But as Donald Trump repeatedly pummels the senior Republican senator from Arizona, saying he has "not done a good job for the vets," that record is getting a second look.

In fact, there is an ongoing dispute between veterans groups and the Senate Armed Services Committee chairman over the access that veterans, in the wake of the Veterans Health Administration scandal, have to private doctors. McCain is in favor of more access, while veterans groups are against expanding it too far across the board, fearing such a move would undercut services at the VHA.

That may be why veterans groups have been basically mum when it comes to defending McCain from Trump's slights, which came after the senator released a statement "deeply" disagreeing with the GOP presidential nominee over his attacks on the parents of Capt. Humayun Khan, a Muslim American soldier who was killed in Iraq in 2004.

The senator, who faces a tough reelection battle this year, still supports Trump, even though the GOP standard-bearer has slammed McCain's record on veterans and initially refused to back him in his primary later this month.

"We're nonpartisan, our bylaws and our constitution requires us to be nonpartisan, and if we start getting into that discussion, " said Lou Celli, veterans affairs director for the American Legion, ". . . that really falls into the electoral dispute."

But the groups' reluctance to speak out might also have to do with recent legislative battles between McCain and veterans groups.

Much of McCain's standing among veterans comes from his five-year ordeal as a prisoner of war in Vietnam.

McCain has become a dogged personal advocate for veterans in Arizona and nationally. Along the way, he's picked up a slew of awards from major national veterans service organizations.

He has echoed that advocacy in various legislative efforts as well, including the 2015 Clay Hunt bill to help suicide-prevention efforts at the Veterans Affairs and Defense departments, the 1991 "McCain bill" that set up standards for releasing information about Vietnam veterans lost during the war, and a current effort to help families of fallen soldiers to travel to Dover Air Force Base to witness the return of their loved ones' remains.

That work had veterans advocacy groups such as the Veterans of Foreign Wars and Iraq and Afghanistan Veterans of America (IAVA) flying to McCain's defense last year, when newly minted presidential contender Trump first went after him for being captured.

In the past few months, however, the VFW, the American Legion and IAVA have been locked in a bitter dispute with McCain over his proposal to expand the "Veterans Choice" program.

The current program, which McCain successfully got through Congress in 2014 with the groups' support, allows veterans who live at least 40 miles from the nearest VA health facility — or who have been waiting more than a month to see a doctor — to be seen at a private facility.

The initiative came on the heels of the VA scandal that revealed patients facing inordinately long wait times to see their doctors. The department is still trying to clear up a crippling backlog of cases, and the wait time for care is still too long.

As VA continues to work on the issue, McCain has sought to expand the "Choice Card" program to every veteran — a proposal that has brought cheers from the GOP, and jeers from the veterans' groups, who see the move as dangerously undercutting the guarantee of VA-provided health care without necessarily ensuring that veterans will be treated better at private providers.

In June, the VFW, American Legion and Disabled American Veterans jointly called McCain's expansion plan a "grandiose" and "unrealistic" proposal seeking to "promise unlimited choice, which in itself is unsustainable, and in reality could force millions of veterans to lose the option to use VA health care," putting more cost burden on veterans in the long run.

The issue of veterans' choice has already made its way to the presidential campaign circuit, where Hillary Clinton has decried efforts like McCain's to move away from specialized, VA-centered health care as privatization. Trump — despite his open criticism of McCain — has effectively proposed his own version of a choice plan similar to McCain's idea.

In Congress, McCain has found support for his proposals from groups like Concerned Veterans for America, a group that receives financial backing from the conservative Koch brothers and is often at odds with the more established veterans' service organizations.

Recently, McCain got into an open fight with some of those veterans groups, which he accused in May of opposing his choice plan because they were too close to VA.

That fight over the choice program appears to be affecting McCain's stance on other veterans legislation. This spring, McCain was quoted telling a Phoenix radio station that a massive bill promising sweeping changes to accountability, the health care system, and the general culture at VA is "very bad." That bill has the support of the VFW, the American Legion, DAV and other major groups.

He argued that the accountability safeguards were not strong enough, and that there should be more options for veterans to seek health care outside the VA structure.

When he's not in lock step with the veterans' groups, McCain is often right in line with Republicans.

In 2014, for example, he opposed a Bernie Sanders-written bill to expand health, education and job-training benefits for veterans that the service organizations backed. But so did all but two of the GOP senators.

This year, his committee eliminated about $38 million in the president's budget request to fund a Pentagon pilot program to help service members freeze their eggs and sperm for use after they leave the military, a program other Republicans said might be too expensive to pursue in a time of sequestration.

And his position on expanding veterans' health care options to the private sector is popular in the GOP.

McCain has opposed certain veterans benefit expansions that were popular across both parties as well, most notoriously in 2008, when as the presidential nominee he opposed offering post-9/11 soldiers expanded educational benefits in the new GI Bill. While McCain didn't vote, the measure passed 92 to 6.

IAVA gave McCain a "D" for his record on veterans issues between 2007 and 2008. That rating, however, only took into account 12 veterans-related votes in the 111th Congress; it does not include any assessment of McCain's personal advocacy on behalf of veterans, or work he did for constituents through his office.

But that work is significant: According to McCain staffers, the senator's office worked on 3,500 VA-related cases in 2014 — over a third of which involved non-Arizonans — helping to secure benefits and retroactive payments. His office has completed work on over 2,000 VA-related cases thus far in 2016, and an additional 750 such cases are in the queue. McCain's office has nine staffers who work on them — four of which are solely dedicated to VA-related issues.

Trump, it is worth noting, is not the first politician who has accused McCain of having a shoddy record on veterans issues. Democrats have been doing it for years.

And despite his legislative stands, it's clear McCain is still a hero to many veterans, some of whom say that his stand on Trump could count for more than any vote, favorable or unfavorable, he has ever cast in Congress.

"I don't know all of [McCain's] votes," said James Lyons, a veteran demonstrating on Capitol Thursday and calling on McCain to revoke his endorsement of Trump. "But I do know that he has always advocated for veterans."

Karoun Demirjian covers defense and foreign policy and was previously a correspondent based in the Post's bureau in Moscow, Russia.

