A federal judge ordered Ohio’s elections chief Wednesday to set early voting hours on the three days before elections, a ruling that gives Democrats a victory going into this fall’s vote.

The order from U.S. District Judge Peter Economus comes in a dispute that began before the last presidential election. The fight was especially intense because of Ohio’s role as a swing state rich with electoral votes.

President Barack Obama’s re-election campaign and Democrats filed a lawsuit in July 2012 against Secretary of State Jon Husted, a Republican, over an Ohio law that cut off in-person, early voting for most residents three days before Election Day.

The law, passed in 2011, ended in-person voting on the Friday evening before a Tuesday election.

But it allowed an exception for military and overseas voters to cast a ballot until Monday.

Democrats argued that amounted to unequal treatment of voters and said everyone should have the chance to vote on the three days before Election Day.

Ohio voters may cast an absentee ballot by mail or in person before Election Day without giving any reason.

Economus had granted Democrats a temporary order in August 2012 that allowed voting to occur on the three days before the November presidential election.

The two sides had been unable to resolve the litigation.

The federal court in Columbus had set a trial date, though the Democrats had sought a summary judgment from the court.

In Wednesday’s decision, Economus said Husted was required “to set uniform and suitable in-person early voting hours for all eligible voters for the three days preceding all future elections.”

Husted said in a statement that he would follow the judge’s order. The court didn’t mandate specific hours, and Husted’s statement did not include any new early voting times.

Democrats in Washington and Columbus praised the ruling.

Democratic National Committee Chair Debbie Wasserman Schultz called it “a victory for the democratic process.” The state party chairman, Chris Redfern, said the ruling highlights the importance of the last three days in ensuring equal access to the ballot.

Husted had pressed state lawmakers to put the hours and days for early voting into law. But the GOP-controlled Legislature did not adopt any plan.

In absence of legislative action, Husted set early voting times for the statewide elections this fall. He used a proposal from the bipartisan Ohio Association of Election Officials. Of the three days at issue in the lawsuit, voters could cast an early ballot only on the Saturday before the Nov. 4 election.

Economus said in his ruling that Husted’s directive did not include the two days at issue in the lawsuit and that it could not serve as a remedy.

Majority Republicans have made other changes to Ohio’s voting rules. This year, they eliminated so-called golden week, a period when residents could both register to vote and cast an early ballot at the same time.