(Reuters) - Florida’s policy of banning felons from voting until they petition the government is unconstitutional and forces them to “kowtow” to the whim of state politicians, a federal judge ruled on Thursday.

FILE PHOTO - A voter walks to a poll with no line as it opened for the U.S. presidential election in Miami Beach, Florida, U.S. November 8, 2016. REUTERS/Joe Skipper

The ruling comes in a lawsuit filed on behalf of nine ex-felons denied the right to vote.

Almost all states deny incarcerated criminals the right to vote, but Florida, an often crucial state in presidential elections, is one of only four to not automatically restore voting rights after felons have completed their sentences.

“In Florida elected, partisan officials have extraordinary authority to grant or withhold the right to vote from hundreds of thousands of people without any constraints, guidelines or standards,” U.S. District Judge Mark Walker wrote in a 43-page decision, saying he would rule later on how the state should fix the system.

Governor Rick Scott’s communication director, John Tupps, said in a statement that Florida’s process for restoring voting rights to felons had been in place for decades and that Walker’s ruling broke with U.S. Supreme Court precedent.

“The governor believes that convicted felons should show that they can lead a life free of crime and be accountable to their victims and our communities,” Tupps said, adding that the office would defend it in court.

The Fair Elections Legal Network, which filed the lawsuit on behalf of the plaintiffs, could not be reached by Reuters for comment.

“Today a federal court said what so many Floridians have known for so long — that the state’s arbitrary restoration process, which forces former felons to beg for their right to vote, violates the oldest and most basic principles of our democracy,” Jon Sherman, senior counsel for the organization, told local media.

In his ruling, Walker said the state subjected felons to a lengthy and arbitrary process to get their voting rights back.

“To vote again, disenfranchised citizens must kowtow before a panel of high-level government officials over which Florida’s governor has absolute veto authority,” he wrote.

The judge cited one clemency hearing at which the Republican governor announced: “We can do whatever we want,” and another where Scott restored a felon’s rights moments after the man said he voted illegally for him.

Last month the Florida elections officials approved inclusion on the November ballot a measure that would restore voting rights to people who had completed their sentences, unless they had been convicted of murder or a serious sex offense.