When you think of Tom Cotton, you probably think of the senator who advocated for the use of the military to persecute Black Lives Matter protesters. And, when you think of the 2020 presidential election, you probably think of Republicans colluding with Donald Trump’s efforts to overturn election results. But that’s overly simplistic.

In case you missed it, Republicans in Congress were pushing to reject the certification of Electoral College votes for the presidential election in the run-up to Jan. 6. Senators Josh Hawley and Ted Cruz began a bidding war to see who could get the most credit for pledging to oppose certification. Then, just as it appeared that a critical mass of Republicans were about to join the bandwagon, Cotton declared that he would oppose Trump’s push and support certification.

Despite receiving an immediate rebuke from Trump, many of us assumed Cotton’s actions were calculated, if counterintuitive. Perhaps he was betting that refusing to certify the election results would be a political loser in the long run. Cotton might have reasoned that he’d never get to the right of Hawley and Cruz in a race to the bottom in 2024, so why not carve out a slightly saner niche? Cotton’s motivations, however, were much nobler, as his timing was moved up to prevent the anti-certification movement from breaking through at a time when it seemed eminently possible.

As the push for GOP Senators to vote against certification gained traction, “Cotton, in collaboration with Senate Majority Leader Mitch McConnell of Kentucky, was maneuvering behind the scenes to derail the outgoing president’s effort to remain in office, and marginalize those Republicans who were abetting him,” writes Drucker.

Cotton contacted McConnell after determining that Trump’s objections were unconstitutional, and “together, they plotted to countermand Trump’s bid to overturn the election and neutralize interest in objecting to Biden’s victory that was developing in some quarters of the Republican conference,” according to Drucker.

Cotton appears to be straight out of right-wing central casting, with his Southern twang, authoritarian streak, and hawkish foreign policy.

Life is complicated, and heroes aren’t always the people you expect them to be. Liz Cheney and Adam Kinzinger supported Trump and voted against his first impeachment, but they emerged as heroes when the 2020 election was at stake.

To the extent that Trump’s coup was viable, it was averted thanks to the efforts of a number of conservative judges and Republican politicians, including Georgia Secretary of State Brad Raffensperger and elections official Gabriel Sterling—as well as Arizona Gov. Doug Ducey and, yes, Tom Cotton.

Cotton’s military background appears to have played a role in this decision. Cotton explained in an eerily prescient Politico piece titled “What I Learned at War” in August 2015, “As soldiers advance up the chain of command, we expect them to show moral courage, which can be even more difficult.” It’s easy to remain silent when a commander proposes a bad plan or when others engage in misconduct, but that’s not what we expect from soldiers. That is why leaders such as Drill Sergeant [George] Norton always said, “Do the hard right over the easy wrong.” “Just as my father always advised the ‘do-right rule.'”

Cotton, of course, is a deft strategist as well as a staunch constitutionalist, and he went about doing the right thing in a very shrewd, strategic manner. A frontal assault on Trump’s power grab would almost certainly have failed, rendering him politically impotent (if not unemployed). Cotton dealt the most severe blow to Trump’s worst ambitions by biding his time and preserving his conservative credibility until the right moment.

According to Drucker, “the number of objectors never snowballed beyond Cruz and his compatriots, Hawley, Senator Kelly Loeffler, who had been ousted the day before in one of the Georgia runoffs, and Senator Rick Scott of Florida, an aspiring 2024 candidate and the incoming chairman of the National Republican Senatorial Committee.”

Heroes aren’t without flaws. Cotton should be commended for doing the right thing when America desperately needed him to. While Hawley and Cruz put pandering and their presidential ambitions ahead of their country, Cotton put first things first. And for this, he deserves our gratitude.