In the spring of 2000, John McCain did something exceedingly rare for a presidential candidate. He admitted that he hadn’t been straight with voters about his views on the Confederate flag.

Believing he had a shot at winning the South Carolina Republican primary and wresting the Republican nomination from George W Bush, he had concealed his true feelings, that the flag should be removed from the state’s capitol dome. Instead, he had said the state should decide and that the flag was a symbol of heritage. He lost the February primary anyway.

The dissembling haunted him. His candidacy and political career were based on his promise to be straight with voters. When he returned to South Carolina in April he did something stunning. He apologized.

“I feared that if I answered honestly, I could not win the South Carolina primary,” he admitted. “So I chose to compromise my principles. I broke my promise to always tell the truth.”

His 2000 campaign was refreshingly different. He looked like he was having the time of his life riding on his campaign bus, the Straight Talk Express. Even as his chances of winning the GOP nomination dimmed, the atmosphere on the bus was almost giddy. McCain actually believed that politics was about something bigger than himself. It was his time. It’s sad that his party, then as now, could not stomach an honest maverick who reviled bogus rightwing issues like the flag.

Something riveting and unSpinnable and true David Foster Wallace, on McCain's 2000 campaign

The best account of McCain’s political career is from that time. It’s a long piece Rolling Stone commissioned from the novelist David Foster Wallace, who spent the week leading up to the South Carolina primary on the campaign trail with McCain. Wallace had a keen bullshit detector and was lethally funny and perceptive about all aspects of American politics. But the McCain campaign passed his bullshit test as “something riveting and unSpinnable and true”.

Wallace was deeply impressed by McCain’s inspiring life story and real heroism during his time as a POW in Vietnam.

“It has to do with McCain’s military background and Vietnam combat and the five-plus years he spent in a North Vietnamese prison, mostly in solitary, in a box, getting tortured and starved. And the unbelievable honor and balls he showed there. It’s very easy to gloss over the POW thing, partly because we’ve all heard so much about it and partly because it’s so off-the-charts dramatic, like something in a movie instead of a man’s life. But it’s worth considering for a minute, because it’s what makes McCain’s ‘causes greater than self-interest’ line easier to hear.”

That heroism was hard to reconcile with other parts of McCain’s story. I first encountered him in 1989, when he was a relatively new senator and one of the notorious Keating Five.

Accused of intervening on behalf of a corrupt Arizona savings and loan executive, McCain had also accepted campaign contributions from Charles Keating. I was covering the scandal for the Wall Street Journal. The other four senators embroiled in the scandal were mostly hunkered down with their lawyers, but McCain was a relative open book.

He invited me to come to Arizona for a week and see how he was handling the scandal back home. We had hours to talk as I drove around the state with him, attending Lion’s Club lunches and all kinds of constituent meetings where he was often grilled about what he’d done for Keating. He was deeply scarred by the beating his reputation took and told me it was more painful in many ways than his time in Vietnam. But his fundamental honesty about making mistakes helped save his political career. His lack of defensiveness was quite remarkable.

After surviving a Senate ethics committee investigation and re-election, McCain turned the scandal into a calling and worked for the next decade to pass stringent campaign finance reform, a cause that ultimately failed, in large part because of the intransigence of his nemesis, the Kentucky Republican Mitch McConnell. But McCain never gave up trying to reduce the influence of big money in politics.

It is tempting when someone dies to gloss over their weaknesses, but McCain would cringe over some of the glowing tributes pouring in. His 2008 presidential redux, this time as the GOP nominee, was marred by his selection of Sarah Palin, the dimly qualified Alaska governor, as his running mate. Palin’s crude campaign style and demagoguery foreshadowed the rise of Donald Trump, another McCain nemesis.

There were redeeming features of the 2008 race, including McCain’s rebuke to a New Hampshire voter who called Obama an Arab. His famous brushback –“No ma’am. He’s a decent family man, a citizen that I just happen to have disagreements with on fundamental issues, and that’s what this campaign is all about” – was an example of his fundamental decency.

Trump’s baseless trashing of McCain’s war heroism and crass dissing even after the Arizona senator was diagnosed with incurable cancer were evidence of how low this president goes when he attacks the people who disagree with him on fundamental issues. McCain’s most important act in the Senate may have been his 2017 vote to uphold the Affordable Care Act, which Trump promised to abolish.

It, too, was a cause bigger than himself.