A federal judge ruled Monday that Ohio must count improperly cast ballots this fall if the mistake is caused by an election worker rather than the voter, a small but potentially significant issue in an important presidential battleground state.

The decision could mean that thousands of votes that otherwise would have been rejected — most of them cast in urban areas where Democrats are concentrated — will have to be counted.

“Recent experience proves that our elections are decided, all too often, by improbably slim margins — not just in local races . . . but even for the highest national offices,” U.S. District Judge Algenon L. Marbley wrote. “Any potential threat to the integrity of the franchise, no matter how small, must therefore be treated with the utmost seriousness.”

The legal fight is probably not over. “We respectfully disagree with the judge’s ruling and will likely appeal,” said Matt McClellan, a spokesman for Ohio Secretary of State Jon Husted (R).

It is one of several contentious voting issues in Ohio, which has a history of close presidential elections, partisan battles to control whose votes are counted, and litigious interest groups and politicians.

Among other issues, the Obama campaign is suing over a decision by the Republican-controlled legislature to curtail early voting in the state. Democrats are incensed about Husted’s decision that weekend voting before the November election should not be allowed. And a conservative voting rights group is threatening to sue to remove what it says are questionable registrations among the state’s more than 7.7 million voters.

Marbley’s decision, which relied in part on the Supreme Court’s 2000 ruling in Bush v. Gore, concerned a subset of votes called provisional ballots. Such ballots are cast when a voter has some irregularity — a lack of proper ID, a name change not recorded, a missing entry on the voter rolls — that keeps him or her from filing a regular ballot. Local boards of elections then must decide whether to count them.

The civil rights group Advancement Project, the Service Employees International Union and others challenged a part of Ohio state law that says provisional ballots cast in the wrong precinct should not be counted, even if the voter was following a poll worker’s instructions.

This occurs, particularly in Ohio’s urban counties, because several precincts share the same polling place. Marbley said there was evidence that poll workers often mistakenly send provisional voters to the wrong precinct area, and thus those votes are never counted.

The judge rejected the state’s argument that it must show only that its laws are a reasonable exercise of its power to set election standards.

He also said Husted was wrong to insist that voters are ultimately responsible for their votes and that the provisional ballots are the state’s way of giving a second chance to voters who are not allowed to cast regular ballots.

“This outlook belies a fundamentally misguided view that the state need not protect the right to vote of individuals who, for any number of reasons, are required to cast a provisional ballot,” Marbley wrote.

“The Supreme Court in Bush v. Gore repudiated that position expressed by the secretary with its holding that ‘[h]aving once granted the right to vote on equal terms, the state may not, by later arbitrary and disparate treatment, value one person’s vote over that of another.’ ”

Advancement Project Director Judith Browne Dianis said that Marbley’s ruling “reflects the common sense that voters should not be disenfranchised because of an election official’s error.”

Marbley said at trial that he planned to make his decision in time for what he expected would be an appeal to the U.S. Court of Appeals for the 6th Circuit.