An Ohio county judge ruled Friday that 17-year-olds will be allowed to vote in Tuesday’s primaries, a victory for Bernie Sanders’ campaign.

Franklin County Judge Richard Frye determined that Ohio Secretary of State Jon Husted, a Republican, erred when he ordered that Ohioans who are currently 17 but will be 18 on election day in November not be allowed to vote in the presidential primaries.

Husted’s office said he would appeal the ruling, which applies to all election boards in the state and orders them to accommodate 17-year-olds Tuesday.

The controversy began in December, when Husted issued an election manual that said 17-year-olds couldn’t vote in the presidential primary. But opponents have argued that since 1981, Ohio election law has allowed them to participate.

Frye’s decision addresses a suit that is separate from the federal challenge Sanders’ campaign filed this week, but it amounts to an immediate victory for the Vermont senator, who has benefited from strong support among younger voters.

Sanders spokesman Michael Briggs called the ruling “a victory for democracy.”

Fair Elections Network, which filed the challenge Tuesday, also praised the decision. “Engaged, civic-minded young adults are who we want to encourage to participate in our democracy. I hope this ruling provides that encouragement,” Rachel Bloomekatz, a lawyer for the group, said in a statement.

Husted, however, has argued that it has been longstanding practice to allow 17-year-olds who turn 18 by election day in November to vote in races except presidential primaries. He blasted the ruling as “last-minute legislating from the bench on election law.”

“Our system cannot give one county court the power to change 30 years of election law for the entire state of Ohio, 23 days into early voting and only four days before an election,” Husted said in a statement on Friday.

An appeals hearing has been scheduled for Monday morning.