A federal lawsuit filed by the Virginia Democratic Party claims that some voters in the state may be kept from casting a ballot in November after their names were wrongly placed on a list meant to weed out fraud.

The court action names Gov. Robert F. McDonnell and Attorney General Ken Cuccinelli II as defendants and alleges that there were political motivations behind a “purge list” of about 57,000 voters whose names were also found on voter rolls in other states.

The lawsuit, which comes as the contentious governor’s race enters its last month, contends that the list is inaccurate and that many of those voters are eligible to vote Nov. 5 in Virginia.

Filed Tuesday in U.S. District Court in Alexandria, the complaint seeks to stop state and local election officials from striking those names from voter rolls. The names were discovered as part of a data-sharing program with 25 other states, which the lawsuit contends is “deeply flawed.”

“At best, Defendants’ conduct reflects inadvertent sloppiness in attempting to ensure that unqualified voters do not vote in Virginia’s election,” the complaint reads. “At worst, the conduct is driven by partisan politics.”

Cuccinelli’s office called the legal action a “spurious and baseless” attempt to affect the outcome of his race for governor against Democrat Terry McAuliffe.

“Suing the attorney general is a shameless stunt, as under the law, he is clearly not an appropriate party to the lawsuit,” Cuccinelli’s communications director, Brian Gottstein, said in a statement.

The State Board of Elections, which was also named as a defendant, said the practice of creating a list of potentially fraudulent voters is part of its mission under state law.

Since 2007, the state board has participated in a data-sharing program with other states, known as a Crosscheck Program, and sends a list of questionable matches to local election officials for review, officials said.

“This list maintenance process was conducted in a non-discriminatory manner based solely on the official notice provided by other states’ registration officials,” according to a memo provided by the agency. “All voters identified in the Crosscheck Program were matched based on a 100% exact match of first name, last name, date of birth and last four digits of their Social Security Number.”

State Democrats argue that the practice can lead to arbitrary purging by local election officials, many of whom were appointed by McDonnell.

The lawsuit cites several cases in which the Democratic Party learned that people whose names appeared on the list turned out to be qualified Virginia voters.

In Fairfax County, for example, about 700 voters out of nearly 8,000 listed appeared to be eligible, the lawsuit said. About 230 voters in Arlington County appeared to be mistakenly listed.

With election pressure ramping up, local officials are scrambling to clean up their voter rolls, which can be complicated.

Voters removed by error will be offered provisional ballots, officials said.

Judy Brown, the general registrar in Loudoun County, said she initially decided to wait until after the election before acting on the list of about 2,100 names her office received from the state.

But, she said, both the state and county boards of elections instructed her Wednesday to pore through the list immediately.

“I will do my best,” said Brown, adding that, so far, she has discovered 410 names that may be eligible.