(Reuters) - A state judge on Friday struck down a Kansas voter registration system that would have prevented people from voting in state and local elections unless they show proof of U.S. citizenship.

The judge ruled that the loss of voting rights for more than 18,000 Kansas residents “far outweighs” the risk posed by potential voter fraud, as the state mentioned only about two dozen people who may have attempted to improperly register to vote over the last 13 years.

“The right of citizen suffrage forms the foundation of a democratic society,” Larry Hendricks, District Judge in Shawnee County, wrote in a 19-page ruling. “Whenever the laws of a state and the federal government clash with respect to this right, cracks are bound to appear in the framework of democracy.”

Kansas has had one of the strictest voter identification statutes in the United States, making the state a symbol for mostly Republican Party supporters who say the rules are meant to prevent voter fraud. Opponents, mostly Democrats, say the rules discriminate against minorities.

Kansas Secretary of State Kris Kobach said by phone on Friday he planned to appeal the ruling adding, “I regard the decision as wrong ... and this decision stands in the way of protecting our elections.”

The American Civil Liberties Union’s lawsuit said the voter registration system established by Kobach violated the state’s constitution and state law and called it “two-tiered.”

“This ruling is a victory for Kansas voters and a stinging rebuke of Secretary Kobach’s repeated efforts to improperly use his authority to obstruct their access to the ballot,” ACLU Voting Rights Project staff attorney Sophia Lakin said in a statement.

The ACLU said the system would have denied the right to vote in state and local elections to residents who registered through a federal voter registration form or when they applied for or renewed their driver’s license.

Under the rejected system, those people could have voted in federal elections but would have had to show proof of citizenship to vote in state and local ones.

The system required registrants to prove their citizenship by providing one of a series of documents, including birth certificates and passports.

Kobach has gained a reputation for pushing a series of voting and anti-immigration measures as a national debate over voting restrictions has accelerated since the Supreme Court struck down parts of the Voting Rights Act in 2013.