Rev. Dr. Robin H. Gorsline, left, president of People of Faith for Equality in Virginia, holds a sign supporting Tracy Thorne-Begland, as Richmond Commonwealth's Attorney Michael N. Herring speaks to the media March 15 in front of the John Marshall Courts Building in Richmond. (EVA RUSSO/AP)

Guns, gays and organized labor.

Three outspoken champions of these hot-button issues in Virginia were on the list of people the General Assembly planned to appoint as judges this week.

The gun-rights guy, a former Republican state delegate who has pushed for lifting restrictions on concealed weapons in public buildings, got his judgeship. So did the pro-union Democrat, another former delegate, whose grandfather organized coal miners in Southwest Virginia.

But not the Richmond prosecutor who challenged the military’s now-defunct “don’t ask, don’t tell” policy, has advocated for gay marriage and is raising twins with his partner.

Virginia’s General Assembly rejected Tracy Thorne-Begland for a Richmond judgeship in the wee hours Tuesday, at the end of a 13-hour session devoted to wrapping up the state budget and appointing more than three dozen judges.

In that final legislative act, the General Assembly was consumed by a divisive social issue, just as it had been time and again this session. Some lawmakers feared Tuesday’s move would bring back unflattering national attention to a swing state crucial to the presidential race.

Del. Mark D. Sickles (D-Fairfax) was bracing for another “Rachel Maddow moment,” referring to the MSNBC host who skewered the state over a bill requiring vaginal ultrasounds before abortions.

However, conservative lawmakers insisted that Thorne-Begland’s outspokenness on gay rights disqualified him from being an impartial judge. The chief deputy commonwealth’s attorney in Richmond had come out as gay as a naval officer 20 years ago on “Nightline” to challenge the military’s now-repealed ban on gays openly serving in the military.

Thorne-Begland’s critics conceded that the two former delegates appointed Tuesday, like the many former lawmakers now on the bench, had taken public positions on countless issues during their political careers. Republican former delegate C.L. “Clay” Athey Jr. of Warren was outspoken on gun rights as a House member, and Democratic former delegate Clarence E. “Bud” Phillips of Southside Virginia was a supporter of labor.

But Thorne-Begland’s advocacy was different, they said, because it amounted to military insubordination and a challenge to the state constitution, which bans gay marriage and civil unions.

“He holds himself out as being married,” said Del. Robert G. Marshall (R-Prince William), who is running for U.S. Senate. He said Thorne-Begland’s “life is a contradiction to the requirement of submission to the constitution.”

Thorne-Begland, 45, declined comment Tuesday beyond a statement issued via e-mail. “I look forward to continuing to serve the citizens of the City of Richmond and the great Commonwealth of Virginia,” read the statement, which also thanked his family and sponsors in the General Assembly for their support.

“He’s an outstanding lawyer and he would have been just as good a judge, and I can’t imagine any reason for his rejection other than his sexual orientation,” said Mike Herring, commonwealth’s attorney for Richmond.

Thorne-Begland needed 51 votes in the 100-member House to win appointment as a General District Court judge who decides guilt or innocence in misdemeanor cases and probable cause in felony cases. Thirty-one voted in his favor. The Senate did not vote on the nomination, but Republicans killed it by passing it by.

“The debate in the House of Delegates was homophobic and embarrassing and showed a disrespect to a chief deputy commonwealth attorney and decorated veteran who was honorably discharged,” said Sen. Adam P. Ebbin (D-Alexandria), Virginia’s first openly gay state senator. “It’s offensive that the Senate wouldn’t even grant Lieutenant Thorne-Begland the courtesy of a vote.”

During the debate, some lawmakers questioned whether Thorne-Begland could faithfully observe the state constitution if he disagrees with some of its provisions. One of them, Marshall, compared him to a polygamist.

“Let’s pretend they were Clarence Darrow, the best lawyer in the 20th century,” Marshall said. “If he were married to three women and applied to be a judge in Virginia, we’d say, ‘No, hell no and never.’ . . . We do not recognize these other relationships at all, and they are outside our normative judgment criteria.”

In response to inquiries from reporters, Gov. Robert F. McDonnell (R) issued a statement that walked a fine line between declaring himself opposed to anti-gay discrimination and contending that he does not know if that played a role in Tuesday’s vote.

“I have long made clear that discrimination on the basis of such factors as race, religion or sexual orientation is not acceptable in any judicial appointment process,” McDonnell said. “In my consideration of judicial candidates I only consider the individual’s ability to do the job well. If anyone voted against Mr. Thorne-Begland because of his sexual orientation, that would be very disappointing and unacceptable.”

Those who opposed the appointment said McDonnell’s statement was consistent with their stance — that they found Thorne-Begland, whose nomination had been cleared by House and Senate committees, to be unfit not because he is gay but because he has advocated for gay rights in ways that have put him at odds with the military and law.

“He has a very different view of certain laws in Virginia — statements on the marriage amendment, domestic partners benefits,” said Victoria Cobb, president of the Family Foundation of Virginia, which had called for lawmakers to reject the nomination and had representatives in the Senate gallery watching until the end. “The question is, would he uphold the law?”

Thorne-Begland had sailed through the nomination process after being interviewed by a judicial selection committee 45 days ago. But about 10 days ago, Marshall and Cobb said they independently learned about Thorne-Begland’s activism. Both said they tried to work behind the scenes with Republican leaders to get the nomination pulled. When that failed, they went public with a push to block his appointment.

Former governor George Allen, Marshall’s chief rival in the Republican primary for U.S. Senate, struck a similar note to McDonnell’s in a statement e-mailed from his campaign.

“Decisions on judges should be merit-based selections based on a person’s skill, ability, fairness, judicial temperament, and fidelity to the Constitution and laws — judges should apply the law, not invent it or impose their own political views,” he said.

A spokesman for Timothy M. Kaine, the Democrat in the Senate race, equated Thorne-Begland’s rejection to discrimination.

“Gov. Kaine believes that the only standard for selecting judges should be their qualifications,” Brandi Hoffine, communications director for the former governor, said via e-mail. “. . . This type of discrimination has no place in government, and serves to pit Virginians against one another at a time when we all need to be coming together.”

Staff writer Ben Pershing contributed to this report.