Almost overnight, Virginia has emerged as a critical state in the nationwide fight to grant gay men and women the right to wed.

This purple state was once perceived as unfriendly and even bordering on hostile to gay rights. That's changed after a seismic political shift in the top three elected offices, from conservative Republicans to liberal Democrats who support gay marriage.

Two federal lawsuits challenging the state's constitutional ban on gay marriage are moving forward, and a hearing on one of the cases is scheduled for Jan. 30.

Along with the recent court rulings in which federal judges struck down gay marriage bans in Utah and Oklahoma, gay rights advocates are heartened by the new mood in Virginia.

Symbolically as well, they say, the challenges of Virginia's gay marriage ban resonate because of the founding state's history of erecting a wall between church and state and a landmark U.S. Supreme Court decision involving a Virginia couple and a past taboo: interracial marriage.

“Virginia is one of several important battlefronts where we have the opportunity now to build on the momentum, embrace the public's movement in favor of the freedom to marry and end the discrimination,” said Evan Wolfson, founder and president of New York-based Freedom to Marry, which seeks to have same-sex marriage bans struck down nationwide.

With the election of Gov. Terry McAuliffe and Attorney General Mark Herring, the state made a hairpin turn away from the socially conservative officeholders they succeeded, particularly Republican Attorney General Ken Cuccinelli, an activist on social issues such as abortion and gay marriage. Herring had campaigned, in part, on marriage equality, and McAuliffe issued an executive order on inauguration day prohibiting discrimination against state employees who are gay.

The lawsuits put Herring's office in the position of arguing against a right he championed on the campaign trail. A spokeswoman said “he's reviewing appropriate legal options.”

Democratic legislators, still widely outnumbered in the House of Delegates, have also been emboldened by the shift away from a reliably conservative state. They took immediate aim at the state's ban on gay marriage, but proposed constitutional amendments face a long road. The earliest voters could see a proposed amendment is in 2016.

The separate lawsuits intended to topple the constitutional ban on gay marriage have been filed in federal courts, which are typically speedy in Virginia. The issue could ultimately be appealed to the U.S. Supreme Court.

One lawsuit, filed in U.S. District Court in Harrisonburg, involves two couples from the Shenandoah Valley who claim the state's ban on gay marriage violates the Constitution's equal protection and due process clauses. The American Civil Liberties Union and Lambda Legal are representing the plaintiffs.

Camilla Taylor, marriage project director for Lambda Legal, said Virginia's “intriguing” history on marriage rights played a role in filing the challenge here. A 1967 Supreme Court decision involving a Virginia couple invalidated laws on miscegenation, or interracial marriage.

The case involved Mildred and Richard Loving. The interracial couple had been living in Virginia when police raided their home in 1958 and charged them with violating the state's Racial Integrity law. They had been married in Washington, D.C.

The Lovings were convicted before ultimately prevailing before the Supreme Court.

“The narrative in Virginia of how marriage plays into Virginia history, why the state was so important nationally for our struggle, is a very significant one,” Taylor said.

Virginia voters approved the same-sex marriage ban 57 percent to 43 percent in 2006. But a Quinnipiac University poll in July found that 50 percent of registered Virginia voters support same-sex marriage, while 43 percent oppose it.

“Their hearts and minds have changed,” Wolfson said of Virginians. “That's exactly why it should not be in the Constitution.”

The judges presiding in the Harrisonburg and Norfolk challenges are appointees of President Barack Obama.