WASHINGTON (AP) - Voters will elect lawmakers to the Virginia House of Delegates using a map seen as favorable to Democrats, under a ruling from the Supreme Court.

The justices' 5-4 decision Monday was perhaps telegraphed by the fact they previously allowed election planning to go forward using the map. Virginia held its primary last week.

Republicans control the House by a slim 51-49 margin. The Republican-run House had urged the Supreme Court to let the state use an election map previously struck down by a lower court as improperly factoring race into the drawing of some districts.

This is the last time the state will use the map to elect lawmakers to the House because that map will need to be redrawn following the 2020 census results.

RELATED: Supreme Court upholds 'double jeopardy' exception in state, federal cases

Attorney General Herring released the following statement about the U.S. Supreme Court decision:

“This is a big win for democracy in Virginia. It’s unfortunate that House Republicans wasted millions of taxpayer dollars and months of litigation in a futile effort to protect racially gerrymandered districts, but the good news is that this fall’s elections will take place in constitutionally drawn districts. I’m really proud of the work my team and I did to protect the new, constitutional districts, and to protect the voting rights of all Virginians.”

View the full writing for the court:

Virginia House of Delegates Speaker Kirk Cox also released a statement:

“Naturally, we are disappointed by the Supreme Court’s decision to reject our standing to appeal this case, which could have wholly been prevented had the Attorney General not once again declined to do his job and defend the law of the Commonwealth.

“The Court’s opinion today ends a disappointing saga of orchestrated attacks against the constitutionally-enacted redistricting plan. A shadowy organization funded by out-of-state interests has cost the taxpayers millions to overturn a legislative map that passed in 2011 that passed with an overwhelming majority.

“Unfortunately, the Court’s decision to not decide the merits of this case leaves a number of unanswered questions just two years before the next redistricting cycle. This could have been prevented if Attorney General Herring would have defended the law of the Commonwealth and allowed the Court to provide an opinion on the merits of this case.

“Regardless of this decision, we are prepared to defend and grow our majority in the House of Delegates. We will run on our record, which includes cutting taxes for the middle-class, freezing college tuition, and standing up for survivors of domestic assault, and the proven results we have delivered over the last two decades. We protected our AAA bond rating through the great recession, set aside over $1.5 billion in reserve funds, raised teacher pay, and made Virginia one of the best states for business. We have recruited a diverse slate of candidates that reflect the communities they seek to serve, including eight women and two African Americans. We are confident that voters will opt for the leadership and results we have delivered over chaos, embarrassment, and unchecked Democratic control of state government.”

In June 2018, a three-judge panel found that eleven House of Delegates districts were unconstitutional racial gerrymanders. 

In July 2018, Attorney General Herring announced that the Commonwealth of Virginia would not appeal the decision, citing the seriousness of the constitutional violation, the low likelihood of success, and the considerable time and more than $4.5 million in taxpayer money spent by House Republicans to defend racially gerrymandered districts.

Writing for the Court, Justice Ruth Bader Ginsburg said: “In short, the State of Virginia would rather stop than fight on. One House of its bicameral legislature cannot alone continue the litigation against the will of its partners in the legislative process.”

“Today’s Supreme Court ruling is a victory for democracy and voting rights in our Commonwealth,” said Governor Ralph Northam. “When we corrected racially gerrymandered districts earlier this year, we righted a wrong—as I have always said, voters should choose their representatives, not the other way around. I am pleased that this fall, every Virginian, no matter who they are or where they live, will cast their ballots in fair and constitutional districts.”