Outraged Virginia Republicans quickly began searching for a way to preserve the state’s gay marriage ban Thursday after Attorney General Mark R. Herring announced that he would join a lawsuit seeking to have it declared unconstitutional.

Some GOP legislators were exploring ways to defend the ban without Herring’s help. Herring’s most ardent opponents sought to take legal action against the attorney general for what they described as his misuse of the office. The National Organization for Marriage, which opposes same-sex unions, called for Herring’s impeachment on grounds of alleged “malfeasance” and “neglect of duty,” though legislators did not go that far.

“I don’t know what the difference between a dictatorship and this is,” said state Sen. Richard H. Black (R-Loudoun).

While Democrats cheered Herring’s move as a victory for civil rights, Republicans said the attorney general had made an outrageous attempt to thwart the will of the people. Herring (D) is siding with plaintiffs in a lawsuit challenging the ban, which was added to the state Constitution just eight years ago with the support of 57 percent of voters. Herring voted for the constitutional amendment but more recently has said his views have changed.

Some Republicans saw in Herring the height of hypocrisy since he won his election largely by criticizing the activist tenure of his predecessor, Ken Cuccinelli II (R). They said Herring was taking the law into his own hands for liberal ends just as Cuccinelli's critics claimed he had done to advance a conservative agenda.

“Remember how Mark Herring said he wasn’t going to be an activist attorney general, ‘It’s time to take politics out of the office?’ Funny how that worked out, isn’t it?” said Garren Shipley, spokesman for the Republican Party of Virginia.

Certainly, Herring propelled himself onto the national stage, perhaps eclipsing Lt. Gov. Ralph S. Northam (D) in the early positioning for the 2017 governor’s race. He also placed Virginia, already a political battleground, at the center of the national debate on gay marriage. He may also have positioned himself to come under more pressure from liberal interest groups to take similar actions on other issues.

Herring’s move could make it harder for Gov. Terry McAuliffe (D) to get anything done with the Republican-dominated House of Delegates. Just two weeks after he took office alongside McAuliffe, Herring’s action further charged the atmosphere in Richmond, where McAuliffe’s early calls for bipartisanship were already being replaced by Republican grumbling about what they called the new governor’s liberal agenda.

Further, Herring’s move added to a sense of upheaval in a Capitol still in a tailspin over the indictment of former governor Robert F. McDonnell and his wife, Maureen, just two days earlier.

Although he was a vocal supporter of same-sex marriage during the campaign, McAuliffe offered Herring support, but sotto voce. On a day when McAuliffe e-mailed a personal, two-paragraph statement on the death of a Norfolk civic leader, his office volunteered no comment on Herring. When asked, McAuliffe's spokesman provided a one-sentence comment in his voice, not the governor’s.

“Governor McAuliffe supports the Attorney General’s conclusion and his efforts to ensure that all Virginians are treated equally under the law. As this case moves forward, the Governor will continue to uphold his responsibility to execute the laws we have on the books,” spokesman Brian Coy said in an e-mail.

Herring announced Thursday that he thinks the state’s ban on same-sex marriage is unconstitutional and that he had joined a lawsuit brought by two same-sex couples challenging it in federal court. Herring said his chief duty is to defend the U.S. Constitution.

Same-sex marriage status in the U.S., state-by-state

“The Supreme Court is clear: The United States Constitution is the law of the land, the supreme law of the land,” Herring said at a news conference. “I believe the freedom to marry is a fundamental right, and I intend to ensure that Virginia is on the right side of history and the right side of the law.”

Democrats cheered the move as a victory for civil rights.

“Today is a proud day to be a Virginian,” said state Sen. Adam P. Ebbin (D-Alexandria), the first openly gay member of the General Assembly. “We are the birthplace of civil liberties, and it’s exciting to see Virginia getting this right.”

Reaction did not fall strictly along party lines.

“I don’t think he should do it, but I think he can do it, and I think it’s probably within his job description to do it” if he thinks the ban conflicts with the U.S. Constitution, said state Sen. Thomas A. Garrett Jr. (R-Goochland), a former prosecutor.

Cuccinelli, who lost a bid for governor to McAuliffe, opposed same-sex marriage and vowed to defend Virginia’s constitutional amendment banning such unions.

Herring filed a brief Thursday stating Virginia’s reversal in a lawsuit in Norfolk that challenges the state’s ban.

“The Attorney General has concluded that Virginia’s laws denying the right to marry to same-sex couples violate the Fourteenth Amendment to the United States Constitution,” the brief states.

At a news conference in Richmond, Herring said that the state has been on the wrong side of landmark legal battles involving school desegregation, interracial marriage and single-sex education. He made the case that Virginia should be on the right side of the law and history in the battle over same-sex marriage.

“As attorney general, I cannot and will not defend a law that violates Virginians’ fundamental constitutional rights,” he said.

As they opposed the move, some Republicans deliberately avoided weighing in on the merits of such a ban, focusing instead on the process. They said they would continue to promote already-submitted legislation to allow the General Assembly to fund a legal defense for state laws that the attorney general declines to defend.

“Here in Virginia, the state’s Marriage Amendment is a matter of perennial legislative debate, and that Amendment could well fall: the voters could repeal it or a court may strike it down,” Sen. Mark D. Obenshain (R-Harrisonburg), who narrowly lost the attorney general’s race to Herring, said in a written statement. “But it is emphatically not the role of the Attorney General to make that determination unilaterally, and that may well be the consequence of Attorney General Herring’s decision.”

House Speaker William J. Howell (R-Stafford) focused on “the dangerous precedent it sets with regard to the rule of law.”

Herring said at his news conference that there is precedent for his action, citing past instances when attorneys general have declined to defend state law.

However, in at least one past instance, Cuccinelli appointed outside counsel to represent the state in a lawsuit over a school-takeover law that the Republican thought was unconstitutional.

“I have always understood that it was the Attorney General’s job to defend state laws and the constitution, not to spend taxpayer money attacking them,” Cuccinelli wrote in an e-mail Thursday. “It is rare enough for an Attorney General to encounter a situation where he believes he shouldn’t defend some provision of Virginia law, but the proper step at that point is to simply stand aside and arrange for a lawyer outside the AG’s office who will defend the law.”

Michael Laris and Rachel Weiner contributed to this report.