John McCain, who died today, represented the great might-have-been of the Republican Party. He was never going to be president, despite two tries, and his status as a maverick limited his influence within his own party.

At his finest (which was all too fleeting), McCain pointed the way to moving conservatism from the fever swamps forward into modern society.

What made McCain unique among Republicans was his willingness to change with time. Nowhere was that clearer than his stand on LGBTQ issues.

For most of his career as a senator, McCain was a staunch opponent of LGBTQ rights. In particular, McCain stood out for his decades-long opposition to openly gay and lesbian military personnel.

When Don’t Ask, Don’t Tell (DADT) was being floated in 1993, McCain helped lead the charge against it. He fretted that “the homosexual community” was calling the shots.

McCain pressed Colin Powell, then head of the Joint Chiefs of Staff, about what would happen if someone went to a parade “in transvestite clothing.”

Eventually, McCain became the policy’s staunchest defender. When the Obama administration moved to repeal DADT, McCain did everything in his power to stop the policy change, pointedly dismissing the findings of a study that the change would have no impact.

McCain even accused then-Secretary of Defense Robert Gates, a fellow Republican, of being “clearly biased” and intent on ending the policy “by fiat.”

When McCain finally lost his fight, he gave a bitter speech on the Senate floor in which he said the repeal was “a very sad day.”

“There will be high fives all over the liberal bastions of America,” McCain thundered, adding that most supporters of the policy change “never have served in the military.”

Indeed, McCain positioned himself as not just the voice of the military, but the embodiment of it.

McCain was a war hero, serving seven years as a prisoner of war in brutal confinement after being shot down during the Vietnam War. That record gave his complaints credence even when they didn’t deserve it.

But here’s where McCain proves such a confounding figure: when President Trump announced last year, via Twitter, his ban on transgender military personnel, McCain stood up to oppose it.

“It would be a step in the wrong direction to force currently serving transgender individuals to leave the military solely on the basis of their gender identity rather than medical and readiness standards that should always be at the heart of Department of Defense personnel policy,” McCain said.

It’s not the first time McCain switched positions on LGBTQ issues. He was a long-time opponent of the Employment Nondiscrimination Act (ENDA), which would prevent workplace discrimination based on sexual orientation.

But then, in 2013, he was one of only a handful of senators who voted in favor of the bill.

McCain also advocated on behalf of Eric Fanning, an openly gay man who became Secretary of the Army in 2016. When the Trump administration nominated Mark Green, a Tennessee state senator, to replace Fanning, McCain said Green’s history of anti-LGBTQ comments was “very concerning.”

Green eventually withdrew his nomination.

Even in his opposition, McCain generally kept a note of civility when disagreeing with people. When he appeared on Ellen DeGeneres’ show in 2008 as a presidential candidate, DeGeneres challenged McCain on his opposition to marriage equality. McCain’s response was firm, but respectful.

“Well, I’ve heard you articulate that position in a very eloquent fashion,” McCain said. “We just have a disagreement. And I, along with many, many others, wish you every happiness.”

Compare that to the take-no-prisoners language of some of his colleagues in the U.S. Senate.

Ted Cruz, whom McCain has called a “wacko bird,” said that marriage equality would lead to the persecution of Christians. Rand Paul, also referred to as a “wacko bird” by McCain, equated marriage equality to a “moral crisis” in America.

It’s not as if McCain emerged as a fervent supporter of LGBTQ rights, but he grew to accept LGBTQ people as part of modern America. He was still a conservative, but he didn’t see modest support for LGBTQ rights as a betrayal of his principles. He changed as the country changed.

Unfortunately, that makes the betrayal of his principles during the 2008 presidential campaign all the more disappointing. McCain was never a favorite of the religious right like George W. Bush, whom he ran against for the presidential nomination in 2000.

The religious right had good reason to despite McCain. He called Pat Robertson and Jerry Falwell “agents of intolerance” in a campaign speech. The religious right also vehemently objected to McCain’s effort to limit campaign spending, which would hinder their electoral influence.

As the religious right tightened its grip on the Republican Party, McCain willingly bowed. Just eight years after his (accurate) description of Robertson and Falwell, McCain assiduously courted evangelical voters, pandering to them by adopting their rhetoric.

McCain accepted the endorsement of virulently anti-LGBTQ figures like John Hagee, stubbornly refusing to repudiate Hagee after his controversial comments came to light before eventually giving in.

Despite his opposition to marriage equality, during his 2008 campaign McCain held off making any statement about California’s Proposition 8, which banned same-sex unions. Then the religious right came at him for being a squish.

James Dobson, founder of the Family Research Council, blasted McCain not giving “a hoot about the family.” McCain then dutifully issued a statement urging California voters to support the measure.

McCain also paved the way for ignorant ideologues in the White House by choosing Sarah Palin as his running mate. Her red meat rhetoric grew to outshine the man who made her and became the hallmark of the modern GOP.

Palin made know-nothingism a necessary political attribute that Trump was well suited to exploit.

This description is not the McCain who will be highlighted in his obituaries. McCain was loved by reporters for his openness to them and for his sense of humor. After all, “wacko bird” really is a good description of Ted Cruz.

You’ll hear a lot about McCain’s 2000 campaign bus, the Straight Talk Express, and not a lot about his courtship of “agents of intolerance.”

That’s the sadness behind McCain’s career. When he was telling the truth, he showed that the Republican Party was capable of change for the better. The change was slowly and nowhere near as complete as it should have been, but it also was not reflexive demonization of LGBTQ people.

Yet, given the chance, McCain abandoned his principles for purposes of political expediency. In doing so, he ushered in the new Republican Party, the very one his obituaries duly note he was out of step with for most of his career. That’s McCain’s terrible legacy that will live on for years go come.