On a bad day for good sense in Washington, Sen. John McCain swept a lot of nonsense aside and reminded us how “winning” really works in a democracy.

It begins, Sen. McCain told his colleagues Tuesday in a speech from the Senate floor, with “humility” and with understanding “our need to cooperate” and “our dependence on each other.”

He was talking about the Senate, but also about America.

EDITORIAL

And the measure of a victory in a democracy, he said, is often modest.

“Incremental progress, compromises that each side criticize but also accept, just plain muddling through to chip away at problems and keep our enemies from doing their worst isn’t glamorous or exciting,” he said. “It doesn’t feel like a political triumph. But it’s usually the most we can expect from our system of government, operating in a country as diverse and quarrelsome and free as ours.”

And we might rediscover our bonds as fellow Americans, he said, if we tuned out the blowhards who make a living turning us against each other.

“Stop listening to the bombastic loudmouths on the radio, TV and internet,” he said. “To hell with them!”

As we say, McCain’s speech came at a particularly good moment, just one day after President Donald Trump turned an address to a gathering of Boy Scouts — Boy Scouts! — into a vindictive and boastful harangue. And just hours after the president ripped his own attorney general for the unforgivable sin of not killing an FBI investigation into the president’s ties to Russia. And just minutes after the Senate voted to begin debate on a hardhearted plan to repeal and replace Obamacare, probably just to get the president off their backs.

Boy, we needed McCain’s little dose of decency. More than we knew.

The senator’s speech carried particular weight because he is battling for his life. He suffers from glioblastoma, a form of brain cancer that almost always is fatal. A deep surgical scar cut above his left eye, and he spoke like a man who wanted to get something right while he still could.

McCain’s speech was powerful, as well, because he accepted his share of the blame, as all of us should, for creating a more divided America.

“We’ve all played some role in it. Certainly I have,” he said. “Sometimes, I’ve let my passion rule my reason. Sometimes, I made it harder to find common ground because of something harsh I said to a colleague. Sometimes, I wanted to win more for the sake of winning than to achieve a contested policy.”

The irony here, as we praise McCain in an editorial for the second time in a week, is that he returned to the Senate on Tuesday to vote in favor of beginning debate on the GOP’s alternative to the Affordable Care Act. We think it’s a miserable bill, sure to hurt tens of millions of low-income and older Americans, and wish the senator had voted the other way.

But a debate is only a debate. McCain made clear he could never support the legislation as it stands, and he openly expressed doubt that a tolerable replacement for Obamacare could be found.

“We Republicans have looked for a way to end it and replace it with something else without paying a terrible political price,” he said. “We haven’t found it yet, and I’m not sure we will.”

But it’s probably not in McCain’s political DNA to squelch a debate, even if that meant casting a vote Tuesday in the service of a president who has openly derided him. So be it. A good debate on a bad bill should kill it like sunlight on mold. Late Tuesday, a 57-43 vote that included nine GOP defectors blocked a broad proposal to erase and replace much of the Affordable Care Act.

“What have we to lose by trying to work together to find those solutions?” McCain asked. “We’re not getting much done apart.”

Thoughtful words on a thoughtless day.

Send letters to: letters@suntimes.com.