The Senate had been debating Obamacare repeal for two months, and it all came down to one night.

We already knew Sens. Susan Collins (R-ME) and Lisa Murkowski (R-AK) would probably vote against the Republican plan to overhaul the Affordable Care Act, even the “skinny” version that didn’t do much more than repeal the individual mandate and would, some senators hoped, set up negotiations with the House over a real health care plan. Those two had held firm in their opposition for weeks.

But on July 27, 2017, we didn’t know what John McCain was going to do. And it would take three votes to stop repeal.

The Arizona senator had been noncommittal for days. He was clearly perturbed with the closed-door, rushed process that had produced the GOP’s repeal plans. There was nothing regular about the order, and John McCain was nothing if not a regular order guy. He wanted a bill to go through committees, be subject to amendments, like the Senate is supposed to work. He wanted regular order.

So folks around the Capitol had started to wonder — would McCain really put the kibosh on his party’s No. 1 legislative priority? All we knew for sure was what the Arizona senator, who had recently announced the brain cancer diagnosis that took his life Saturday, instructed a few reporters as he walked onto the Senate floor that fateful night: “Wait for the show.”

I sat down inside the Senate gallery early (for the vote, anyway, this all happened after 11 pm Eastern) — with no idea that I was about to watch one of the most momentous floor votes in recent Senate history.

It became clear something was amiss when McCain spoke briefly with the top Senate Democrat, Chuck Schumer, and Schumer seemed elated. A conversation with the No. 2 Republican, John Cornyn, left Cornyn looking dour.

As Republican leaders held a vote on a Democratic motion open for more than an hour, McCain stood firm. His Arizona colleague, Jeff Flake, sat next to him for some time but seemed unable to get a word in. McCain gabbed with Sen. Lindsey Graham (R-SC), his best friend in the Senate.

The showdown was with Vice President Mike Pence, present in the Senate in case he needed to cast a tiebreaker vote to give the “skinny” repeal bill a 51-vote majority. McCain and Pence spoke for nearly 30 minutes, in a conversation that at times seemed friendly but then turned serious. McCain was insistent. Pence huddled with McConnell and left the floor for a time. McCain stepped into a back room, taking a phone call from President Donald Trump.

But the Arizona senator was unmoved.

For a while, he chatted with Collins and Murkowski — the two senators he would soon join to kill “skinny” repeal — as they laughed and smiled.

In the end, McCain stood dramatically before the Senate chair. He turned his thumb down.

In a statement, the senator named the obvious culprit, the rationale for voting down Obamacare repeal that he had been hinting at for days: This was not how the Senate was supposed to work.

“I’ve stated time and time again that one of the major failures of Obamacare was that it was rammed through Congress by Democrats on a strict party-line basis without a single Republican vote,” McCain said in a statement after his stunning vote.

“We must now return to the correct way of legislating and send the bill back to committee, hold hearings, receive input from both sides of the aisle, heed the recommendations of nation’s governors, and produce a bill that finally delivers affordable health care for the American people,” he said. “We must do the hard work our citizens expect of us and deserve.”

With McCain’s now-legendary thumbs down, the Senate’s last, best hope to repeal Obamacare was finished.