“We won’t reform anything until we first reform the way we finance our political campaigns. As long as special interests dominate campaigns, they will dominate legislation as well. Until we abolish soft money, Americans will never have a government that works as hard for them as it does for the special interests.”

—John McCain, 1999

The wisest response to most mentions of “bipartisanship” is to run screaming from the room. More often than not, “bipartisan” projects involve a collapse of conscience into the corrupt center where the demands of the billionaire class are invariably met.

But it does not have to be that way. We know from the work of John McCain and Russ Feingold on the issue of campaign-finance reform that partisans from opposite ends of the ideological spectrum can come together with the purpose of upsetting the calculations of the elites who have made it their business to control our politics and our governance.

When Feingold was elected to the Senate in 1992, McCain had just finished his first term in the chamber. The senator from Arizona was not identified as a reformer—in fact, his reputation had been tarnished by the 1989 “Keating Five” scandal. He understood, as he would explain some years later, that “The people whom I serve believe that the means by which I came to office corrupt me.” And he said: “That shames me.”

To address that shame, and the broader shame of our money-drenched politics, the Arizonan needed a partner from across the aisle. He chose the newly elected senator from Wisconsin. Feingold told NPR: “He just called me up out of the blue. He said, ‘You seem to have a good record. Would you like to work with me?’ And I said ‘yeah.’ So I never knew exactly why he chose that moment to do it, but he did.”

McCain once told me that he reached out to Feingold because he wanted a partner he could trust to work closely with him when he was right and to challenge him when he was wrong. What appealed to him was not just the fact that Feingold was a Democrat but that he was a progressive Democrat who had values that meant more to him than party labels.

It was this understanding of what it took to forge an honest bipartisan partnership that distinguished McCain, who died Saturday at age 81, from most practitioners of contemporary politics. He knew that it involved more than linking a “D” with an “R.”

Whenever I asked the late senator about Feingold, McCain noted their differences. And they were many.

McCain, the scion of a distinguished military family who spent five brutal years as a prisoner of war in Vietnam, represented Arizona in the US Senate as an rigid conservative on economic and social policy and a foreign-policy hawk with an awful penchant for military interventionism. Feingold, the son of a great labor lawyer, had earned his own high marks as a Rhodes scholar and a serious student of the US Constitution and represented Wisconsin in the Senate as a progressive stalwart who sided with unions and working people, a champion for women’s rights and marriage equality, and a consistent critic of military adventurism who opposed the Iraq War. While McCain was a supporter of the Patriot Act, Feingold cast the only vote against the 2001 measure and remained the chamber’s most vigilant defender of the protections outlined in the Bill of Rights.

Yet these two very different senators established a working relationship that overcame the partisan rigidity that even in the 1990s was beginning to render the Capitol dysfunctional. The pair developed a level of trust that enabled them to become the nation’s most prominent advocates for campaign-finance reform and ethics in politics. Their many years of work together culminated in the enactment of the Bipartisan Campaign Reform Act of 2002, groundbreaking federal legislation that is still referred to as “McCain-Feingold.”

Brennan Center for Justice President Michael Waldman noted in mourning McCain’s death that the senator had been “an extraordinary champion of America’s democratic ideals,” and the same can surely be said of Feingold. The pair found bipartisan common ground on democracy issues—as they did on human-rights concerns and their shared opposition to the use of torture. But they had deep differences on how a democracy might acquit itself, differences that were highlighted by their split over the Iraq War—which McCain encouraged and supported to a fault, while Feingold mounted urgent and ongoing opposition.

Despite their consequential differences, McCain rarely missed an opportunity to hail Feingold’s “trademark integrity and independence.” Feingold displayed an equal measure of admiration for his compatriot in an epic struggle to reform our politics—admiration that the Wisconsinite expressed on Saturday with a simple announcement that “We will all be poorer without his leadership.”

More often than not, I disagreed with John McCain. Even as I applauded his wrangling with Donald Trump on some domestic issues, I remained frustrated with McCain’s approach to foreign policy—especially when it came to his ardent support for military spending, his attacks on the Iran nuclear deal, and his defense of U.S. aid to Saudi aggression in Yemen. And there really are no excuses for his ill-considered (if considered at all) decision to bring Sarah Palin onto the national political stage.

But I came over the years to recognize the sincerity of McCain’s engagement with the campaign-finance issues on which he worked with Feingold. A year before Feingold’s 2010 defeat for reelection to the Senate, the Democrat from Wisconsin and the Republican from Arizona grew increasingly concerned about the steps Chief Justice John Roberts was taking to undermine rules that protected against corporate influence on our campaigns—steps that would, in 2010, culminate in the Supreme Court’s disastrous decision in the Citizens United case.

Together, they expressed their fear that the Court was moving in a direction that “could have serious consequences for our democracy.” In a letter the two senators signed, they counseled against any move that “would open the floodgates to unlimited corporate spending during elections and undermine election laws across the country.” Were the high court to warp campaign-finance laws to favor the billionaire class, they warned, “Those able to spend tens of millions of dollars, like a Fortune 500 company, are much more likely to be heard during an election than average American voters.”

Roberts and his conservative colleagues rejected the wise counsel of the unlikely senatorial allies. Since then, our political processes have taken the antidemocratic turn that McCain and Feingold feared.

But it is vital to remember that the good fight for fair elections and honest governance was once waged by a Democrat and a maverick Republican.

The struggle to renew American democracy will continue. The Citizens United ruling will be overturned. And we will eventually have what McCain and Feingold hoped to see: a politics defined by clashes of ideas rather than campaign spending. Getting there will be hard, and it will almost certainly require cooperation across lines of partisanship and ideology by officials who value democracy more than the favor of the billionaire class.

What John McCain showed us, with the help of Russ Feingold, is that such cooperation is possible.