RICHMOND, Va. (Reuters) - A U.S. federal judge on Thursday upheld a 2013 Virginia law requiring prospective voters to show an approved photo identification before they cast their ballots.

The state’s Democratic Party had challenged the law, signed by former Republican Governor Robert McDonnell, saying it was politically motivated and intended to deter young and minority voters from turning out on Election Day.

“The court’s mission is to judge not the wisdom of the Virginia voter ID law, but rather its constitutionality,” wrote U.S. District Judge Henry Hudson in his decision.

While he noted that the measure created an “inconvenience” for potential voters who did not have drivers’ licenses or other government-issued ID, he said that was not enough to strike it down.

“While the merits of this voter identification law, and indeed all aspects of Virginia’s voting regime, can be reasonably debated, it remains true that Virginia has created a scheme of laws to accommodate all people in their right to vote,” Hudson wrote.

Lawyers representing the state Democratic Party said in a filing that the Republican-dominated state legislature passed the photo ID law “to stall, if not reverse, the growing success of the Democratic Party in Virginia.”

The state argued that ID was necessary to ensure that only registered voters cast ballots and to prevent voter fraud.

In 2008, President Barack Obama became the first Democrat to carry Virginia in more than 40 years, in part because of turnout among black, Latino and young voters. Obama carried the state again in 2012.

In the most recent statewide elections, Democrats also swept all top offices: governor, lieutenant governor and attorney general. Moreover, the state’s two U.S. senators are both Democrats.

Hudson acknowledged that Virginia, a former slave state, has “an unfortunate history of racial and statutory artifice to hinder black voting.”

The ruling comes a month after another federal judge upheld a similar requirement in neighboring North Carolina.

A federal court this week ordered Kansas to register thousands of eligible voters who have been blocked from registering.

That ruling resulted from an American Civil Liberties Union lawsuit filed on behalf of Kansas residents who tried to register to vote through the Kansas Department of Motor Vehicles and had been forced to provide additional documentation of citizenship.