Former Virginia attorney general Ken Cuccinelli II seemed to be caught off-guard by his nomination to the state Supreme Court. (Steve Helber/AP)

A Senate panel on Tuesday nominated former attorney general Ken Cuccinelli II to the Virginia Supreme Court, a move that could both keep Cuccinelli out of the 2017 governor’s race and deal a particularly bitter blow to Gov. Terry McAuliffe.

While the governor and the Republican-controlled legislature have been deadlocked for months over how to fill a vacancy on the state’s highest court, the nomination of Cuccinelli appeared to have enough support from GOP lawmakers to break the impasse.

Cuccinelli (R), who narrowly lost the 2013 gubernatorial contest to McAuliffe (D), seemed caught off guard. “I am humbled and honored to be considered for such a position, but it is not something that my wife and I have previously contemplated,” he said. “Together, we will prayerfully review this possibility.”

A tea party hero for the brash battles he waged as attorney general against abortion, Obamacare and other perceived examples of federal overreach, Cuccinelli is reviled with equal fervor on the left. Establishment Republicans have not been fans, either, and have expressed concern as Cuccinelli has publicly mulled a second gubernatorial bid.

Republicans and Democrats alike speculated that the nomination was aimed at cutting short that possibility — thereby avoiding a potentially divisive nomination contest with former Republican National Committee chairman Ed Gillespie and others who have jumped in.

Judge Jane Marum Roush’s latest recess appointment to Virginia’s high court expired in February. (Matt McClain/The Washington Post)

“I just think the chief motivation behind this is to get him out of the governor’s race,” said Senate Minority Leader Richard L. Saslaw (D-Fairfax). “And they could [not] care less about what it does to the Supreme Court of Virginia.”

Cuccinelli’s name surfaced just days ahead of the General Assembly’s scheduled Saturday adjournment, after which McAuliffe would be free to give a third recess appointment to former justice Jane Marum Roush if the slot remained unfilled.

A freshman Republican who had refused since January to go along with his party’s plan to replace Roush with Appeals Court Judge Rossie D. Alston Jr. said he would support Cuccinelli.

“He’s qualified and not a political pawn in this process,” Sen. Glen Sturtevant (Richmond) said in a text message to The Washington Post.

In a statement, he said: “I hoped we would elect Justice Roush, and I could not vote for Judge Alston. However, now that Justice Roush and Judge Alston have failed to be elected by the General Assembly, I believe it is our responsibility to nominate and elect another candidate who is highly qualified and who can receive a majority of support in both houses.”

Some legislators wondered if Cuccinelli’s nomination was merely a ploy to prompt Democrats to get behind a more moderate Republican-backed candidate instead of holding out for McAuliffe’s pick.

“I’m praying that it is a scare tactic,” said Sen. L. Louise Lucas (D-Portsmouth).

But Republicans brushed off the notion that the nomination was anything other than sincere. “Yes, it’s for real,” said Sen. Mark D. Obenshain (Rockingham).

McAuliffe and Republicans have been at war over how to fill the opening since summer, when the governor gave Roush the first of two temporary recess appointments.

The Republican-controlled legislature refused to give the former Fairfax County Circuit Court judge a full 12-year appointment. Her most recent appointment expired in February, leaving the Supreme Court shorthanded.

Republicans have not questioned the qualifications of Roush, a highly regarded jurist who has presided over many high-profile cases. But they have noted that judicial appointments are theirs to make and have said they prefer Alston, who has served on the appeals court since 2009. Republicans also said McAuliffe violated protocol by not consulting them on the choice.

The lawmakers’ opposition to Roush only grew after she accepted a second recess appointment from McAuliffe, whose authority to grant it was in question because the House had not gaveled out of a special session.

McAuliffe spokesman Brian Coy said it would be “a disgrace” to replace Roush with “an 11th-hour candidate whom voters have already rejected as hostile to their values on women’s rights, gay rights, education, health care, the environment, transportation and a range of other issues.”

Republicans have long had the votes in the GOP-dominated House to install Alston, but because Sturtevant was unwilling to go along they were one vote short in the closely divided Senate. Senate Republicans twice appeared close to persuading a Democrat from the black caucus to support Alston, who is African American. Both times, the effort fell short.

House Speaker William J. Howell (R-Stafford) issued a statement that expressed disappointment about the Senate’s failure to elect Alston. But it also signaled an intention to move ahead to elect someone.

“The Constitution of Virginia obligates the General Assembly to elect the Justices of the Supreme Court; failing to do so would be a dereliction of duty,” it said.