One of Virginia’s top legal officers recounted the commonwealth’s history of discrimination Tuesday in asking a federal judge to strike down the state’s voter-approved ban on same-sex marriages.

Virginia Solicitor General Stuart A. Raphael compared the state constitutional amendment banning such unions to the commonwealth’s previous defense of segregation, a ban on interracial marriage and resistance to admitting women to VMI — all decisions overturned by the Supreme Court.

“We are not going to make the mistakes our predecessors made,” Raphael told U.S. District Judge Arenda L. Wright Allen.

Wright Allen did not ask a question of any of the five lawyers who addressed her during the nearly two hours of arguments but said she will rule quickly on an issue that all agreed will ultimately be settled by the Supreme Court.

“You’ll be hearing from me soon,” she said, emphasizing the last word.

At issue is a question the Supreme Court justices left unanswered in June in their first consideration of same-sex marriage: Does a state’s traditional role in defining marriage mean it may ban same-sex unions without violating the equal protection and due process rights of gay men and lesbians?

The case in Wright Allen’s courtroom marked the first time such a challenge has advanced so far in a state that was part of the Old South.

New Virginia Attorney General Mark R. Herring (D) infuriated Republicans and conservatives in the state when he decided soon after taking office last month that he would not defend the ban.

Republicans in the legislature — and some sign-carrying critics outside the courthouse Tuesday — accuse him of abandoning his duty to defend state laws. The House of Delegates has passed a bill that would allow it to hire its own lawyer to participate in future legal proceedings, at the U.S. Court of Appeals for the 4th Circuit in Richmond and possibly the Supreme Court.

At Tuesday’s hearing, the law was defended by lawyers for the circuit court clerks in Norfolk and Prince William County, who issue marriage licenses.

One of the lawyers, Austin R. Nimocks, senior counsel for the conservative legal group Alliance Defending Freedom, told Wright Allen that Virginia had an interest in limiting marriage to a man and a woman because of the unique “procreative dynamic” shared by heterosexual couples.

“We have marriage laws in society because we have children, not because we have adults,” said Nimocks, who is representing Prince William Clerk Michele McQuigg. She asked to intervene in the case because she was afraid Herring would take the action he did.

Nimocks said there was no reason to believe that the legislature, and then 1.3 million Virginians, voted for the constitutional amendment in order to discriminate against gays.

Virginia’s law, he said, “celebrates the diversity of the sexes.” It should not be surprising that officials and voters want to protect a traditional view of marriage that has “animated Virginia law for 400 years,” he said.

David Oakley, representing Norfolk Clerk George E. Schaefer, said it might be true that public opinion has changed since 2006, when 57 percent of voters approved the constitutional amendment.

“If there truly has been a shift in public opinion, it is more appropriate to allow the General Assembly and voters to make that decision,” Oakley said.

But lawyers Theodore Olson and David Boies, who have led the legal movement on same-sex marriage, told Wright Allen that courts must step in when there is discrimination.

“Virginia erects a wall around its gay and lesbian citizens, excluding them from the most important relation in life,” Olson said, adding that marriage was a fundamental right that is about “freedom” and “liberty.”

Boies said the state is harming children being raised in same-sex households by “denying recognition and legitimacy” to their parents’ relationships.

And Olson told the judge that she must be suspicious of decisions by the majority that single out groups that have historically been the victims of discrimination.

“Sometimes the voters and the legislature get it wrong,” and the result violates the constitution, he told Wright Allen. “So, we have you.”

The lawsuit is brought on behalf of two Virginia couples. Timothy Bostic and Tony London have lived together for more than 20 years and were denied a marriage license last summer by Schaefer, the Norfolk Circuit Court clerk. Mary Townley and Carol Schall of Chesterfield County were married in California and have a teenage daughter. They want Virginia to recognize their marriage.

It will be the most important decision in the young judicial career of Wright Allen, who was confirmed to the bench in 2011. She is a Navy veteran who has served as both a prosecutor and federal public defender. She was nominated by President Obama on the recommendation of Sen. Mark R. Warner (D) and then-Sen. James Webb (D).

She will need to interpret the Supreme Court's decision in June in U.S. v. Windsor striking down a key part of the Defense of Marriage Act, which withheld federal recognition of same-sex marriages.

On the one hand, the Windsor decision noted the state role in defining marriage. On the other, it dismissed as discrimination many of the arguments used to justify bans on same-sex marriages.

Federal judges in Utah and Oklahoma have said that the reasoning used by the court majority meant that marriage bans in those states cannot stand. Same-sex marriages took place in Utah, but both decisions are now stayed pending appeal.

The highest courts in New Jersey and New Mexico have held that same-sex couples have the right to be married there. Seventeen states, including Maryland but not counting Utah and Oklahoma, now allow such unions.

In addition to the Norfolk suit, the American Civil Liberties Union is challenging the Virginia ban in a federal suit in Harrisonburg. Last week, U.S. District Judge Michael Urbanski certified that as a class action on behalf of the estimated 15,000 same-sex couples in Virginia who might want to marry.