Last week went about as poorly as it could for most Republicans in Alabama. To begin with, they were forced to back the Nickelback of GOP candidates — a relic from a decade earlier who was awful then, and even more so now.

Republicans had Roy Moore foisted upon them as the de facto anti-establishment candidate. By now, we all know the story — the kingmakers in D.C. and Montgomery tried to force Luther Strange down GOP voters’ throats after telling qualified candidates such as Alabama Senate President Del Marsh not to bother and carpet bombing Rep. Mo Brooks with a relentless and untrue ad campaign.

Instead of getting “Big Luther” as the Republican nominee, Roy Moore won, and as things are prone to do with Moore, Tuesday’s special Senate election ended badly for the Grand Old Party.

A Democrat won for the first time in a statewide election in over a decade.

One has to credit Democrats. They did what they had to do. They put up a reasonable candidate. They married an unlikely coalition of African-Americans and suburban voters a generation removed from the white-flight exodus from Alabama’s largest cities.

Republicans knew what went wrong immediately after the final vote tally (and many knew well before) — that the weakness in their strategy was simply Roy Moore.

Moore’s nomination did not seem like it had to be an election-losing proposition. After all, this is Alabama. People would vote for a fire hydrant as long as it had an “R” next to its name.

Moore could withstand whatever was thrown at him, right? His cult of loyal supporters would be enough in what had to be a low-turnout event — a special election in an off-cycle year in the middle of December.

Events like these are traditionally formalities. All of the action happens in GOP primaries, right? Instead, it was the highest-turnout special election in Alabama’s history.

If you add a scandal-plagued candidate, a healthy turnout aided by a barrage of national media coverage and a yeoman’s get-out-vote-effort, a Democrat can indeed win in Alabama.

It was still close. Roy Moore lost to Doug Jones by 20,000 votes, a mere 1.5 percent of the ballots cast. By that margin, it would be fair to say every little bit counted. But what did not help were Sen. Richard Shelby’s antics.

Last month, Shelby publicly proclaimed he would not be voting for Roy Moore. Instead, he said he would be voting for a “distinguished Republican” as a write-in candidate.

That was the shot heard around the Beltway. Even Richard Shelby, a “conservative” Republican from Alabama, couldn’t support Judge Moore.

Doug Jones wisely capitalized on Shelby’s declaration, upon which Shelby would double-down three days before the special election. His campaign ran numerous ads, and Jones’ supporters echoed Shelby’s words all around a media that was hostile to Moore from the get-go.

Shelby can support whoever he wants. However, abandoning the duly elected GOP nominee, who defeated Luther Strange, the candidate that Shelby moved heaven and earth to try to get elected, should have consequences. And it could.

An odd thing happened last week on election eve at Moore’s final rally in Midland City. Rally-goers booed Richard Shelby, and there was no mistake about it. They were booing him. The hardcore Moore supporters had no love for Alabama’s senior senator.

That might not sound like a big deal, given that Moore lost. But the general election voters who participated in last week’s election are the ones that choose GOP nominees. It’s those people who show up to Roy Moore rallies on chilly December evenings in Dale County, which is literally in the middle of nowhere.

Shelby’s behavior during this election cycle was odd. He could have accepted Strange’s defeat and laid low, as most of his Alabama colleagues on the House side of Capitol Hill did. We know Reps. Mo Brooks, Bradley Byrne and Robert Aderholt stuck it out with Moore. We have no idea what Rep. Martha Roby did in this election.

It’s iffy whether Shelby will face punishment from the Alabama Republican Party. If he runs again for re-election, he will be 88 years old. But as one former Alabama Republican Party chairman said, Shelby has been claiming each re-election was his last election for 20 years now.

If he does run, Shelby should face formal action from his party. For starters, he was a post-1994 Republican revolution convert from the Democratic Party. That already shows there’s willingness to shift with the direction of the wind for his political benefit.

If anything, his rhetoric aided and abetted a political enemy. Sure, no one is saying Shelby’s endorsements have a direct impact on how people vote. But you cannot say it made no difference at all.

Now that it’s over, Shelby seems to be in damage-control mode. Somehow, an reporter happened to be at the Birmingham airport to interview him upon his post-election arrival back in Alabama. Shelby also conducted an interview with Howell Raines that graced the pages of The New York Times last weekend.

The goal: Shelby wants to use the John McCain playbook — get back pats from the media to validate his “maverick” behavior.

Bradley Byrne said in a post-election interview with NPR that he voted “Republican,” which wasn’t a vote for Moore the person, but for Moore the GOP’s chosen candidate, and he explained why.

“I think I signed a pledge to vote for Republican candidates,” Byrne said. “If I feel like I can’t vote for Republican candidates, I shouldn’t be a Republican anymore.”

That is probably something Shelby should consider. If he cannot vote for a candidate chosen by Republicans, then maybe the Democratic Party will welcome him back.