Roy Moore's stunning collapse in Alabama represents as a self-inflicted wound by Senate Republicans, however unintentional.

Facing what they believed were few good options, the GOP's top strategists tried to execute a complicated play in a three-way race for the party's nomination to succeed Jeff Sessions, who left the seat to become attorney general.

The path to victory for the establishment favorite, appointed senator Luther Strange, was to ignore Moore on the initial ballot, assuring him a spot in the Republican runoff in late September in the belief that Strange would defeat him and cruise to victory in Tuesday's general election.

As we all now know, that didn't happen. Moore, a controversial former judge, ran away with the Republican nomination, only to fall apart in the general election amid allegations of sexual misconduct with teenagers when he was a local prosecutor in his 30s.

Now, Senate Majority Leader Mitch McConnell (R-Ky.) and his top lieutenants are left with few options other than to contain the damage of this brutal defeat. They will soon hold a perilously thin majority, 51 to 49, in the Senate — and more perilous prospects of losing it altogether in the November 2018 midterm elections.

Senate Minority Leader Charles E. Schumer (D-N.Y.) needs a net pickup of two seats next year, and although that would still seem like a high hurdle — Democrats are defending almost three times as many seats as Republicans are, and 10 of them are in states that Trump won last year — Jones has opened that path.

The Jones victory might encourage other Democrats to make long-shot bids in Republican states such as Nebraska, Utah and Wyoming. GOP incumbents are considered overwhelming favorites in those places, but if a Democrat can win in Alabama, it will provide encouragement to others.

Republicans placed the blame squarely on the shoulders of Moore. Some compared the race to the Louisiana governor's campaign in 2015, when then-Sen. David Vitter (R) lost in a deeply conservative state because the race turned into a referendum on "his activities," in the words of Sen. John Neely Kennedy (R-La.). Those included allegations that Vitter was connected to two prostitution rings years ago.

In Alabama, the race turned entirely into a referendum on Moore.

"My sense is that Mr. Moore is the issue. It just happens in a lot of races that one candidate can become the de facto incumbent, and that's what Mr. Moore is here," Kennedy said.

This is exactly what McConnell has been trying to prevent since the 2012 Senate campaign in Missouri. Then, Republican Todd Akin lost after claiming, in an effort to explain his opposition to abortion even in cases of assault, that pregnancy rarely results from a "legitimate rape." Ever since, Senate Republicans have forcefully tried to defeat candidates they consider on the fringes of public opinion to protect themselves from being damaged by out-of-step views.

GOP establishment goes after Alabama congressman running for Senate for criticizing Trump

Until the Alabama campaign, McConnell's team had a more than four-year run in successfully thwarting those types of insurgent Republicans in primary races. The strategy helped Republicans end the 2014 and 2016 elections with the majority.

But the run ended this year in Alabama, in the unpredictable era of President Trump. And now, Republicans are unsure about how to proceed.

"I guess you can do a postmortem on anything and dissect it, I don't know," Sen. Richard C. Shelby (R-Ala.), who opposes Moore's candidacy, said Monday evening. He then added, perhaps philosophically: "We're where we are today, I wish we weren't where we were, but we are."

This is now the sixth Senate seat that Republicans have lost since 2010 with deeply flawed candidates winning contested primaries, but it is easily the biggest upset given how conservative Alabama is.

In 2014, seven statewide races appeared on the Alabama ballot. Strange, easily winning reelection to his previous post as attorney general, was the only Republican to receive less than 60 percent. He received 59 percent.

There are no well-known, proven public polls in Alabama. Real­Clear­Politics has no public surveys available for the 2016 presidential campaign or for Shelby's reelection last year.

Bitter Senate race tests Alabama’s image in the country — and at home

The only benefit of Tuesday's outcome, for Republicans, is that they will not have to face an endless flow of questions about the ethics investigation into Moore or any other statements that he made as a senator.

"We're all fielding these questions about, whether it's Judge Moore or the latest tweet of the day, it is more than a distraction from the very significant work that goes on around here," Sen. Lisa Murkowski (R-Alaska) said Tuesday, before the polls had closed.

She did not endorse Jones, but she was open in hoping Moore lost.

Back in the summer — what seems like several lifetimes ago — Republicans cooked up the early strategy to try to knock out two GOP candidates who were not in step with establishment views. Interim Gov. Kay Ivey (R) called for the contest this year, because of a backlash against Strange getting appointed by the outgoing governor, Robert J. Bentley, whom Strange had been investigating for corruption as state attorney general.

The oddly timed race allowed anyone to jump in without giving up their current seat, including Rep. Mo Brooks (R-Ala.).

The McConnell-affiliated super PAC, Senate Leadership Fund, mounted a multimillion-dollar campaign to tear down Rep. Mo Brooks (R-Ala.) to ensure that Strange would face Moore in the runoff. One TV ad showed Brooks slamming Trump, early in the 2016 campaign, when he was backing another candidate.

Brooks is a member of the rabble-rousing House Freedom Caucus, giving him credentials with deeply conservative voters, but he also enjoyed inroads more traditional business-friendly interests. The thinking of Senate leaders was that if Strange's allies took out Moore in the initial vote, Brooks would win the runoff in a rout because Moore's past controversies would doom him.

So they buried Brooks's campaign in that initial three-way race. But Moore, 70, defeated Strange by a wide margin, and last month The Washington Post broke the first story about Moore's alleged pursuit of teenage girls nearly 40 years ago.

McConnell tried to force Moore to step aside, but he refused and the race turned into a nail-biter against Jones.

On Monday, Strange, in office just a few months, acknowledged that he was unaware of the custom for outgoing senators to escort their successors into the well of the Senate to be sworn in by the vice president.

Strange presumed that he will not fulfill that role.

"That's a good question, I assume that's up to Shelby, that's kind of what I'm guessing," he said Monday. "That will be his responsibility."

And McConnell's responsibility will be protecting a narrower majority.

Read more from Paul Kane's archive, follow him on Twitter or subscribe to his updates on Facebook.