The Supreme Court ruled Monday that West Virginia's chief justice should have stepped down from a case involving his campaign's biggest financial supporter.

The 5-4 ruling, authored by Justice Anthony Kennedy, is a victory for groups interested in curbing the influence of money on judicial elections. "In all the circumstances of this case, due process requires recusal," Kennedy wrote.

Kennedy's opinion was joined by the court's more liberal justices.

"There is a serious risk of actual bias when a person with a personal stake in a particular case had a significant and disproportionate influence in placing the judge on the case by raising funds or directing the judge's election campaign when the case was pending or imminent," Kennedy concluded. 

The case closely resembles the plot-line in novelist John Grisham's 2008 book "The Appeal." 

The case examined Justice Brent Benjamin's decision not to recuse himself from a $50 million lawsuit involving a man who helped get him elected to the bench. The losing side in the West Virginia mining case before Benjamin argued he should have stepped aside for his "probability of bias" in the case, which involved Massey Coal.

The 527 Massey's CEO formed spent $3 million in ads to help Benjamin's election.

The Supreme Court had previously only recognized the need for recusals when judges have a personal financial interest or some other closely held personal connection to a case. Monday's opinion expands that reach.

The case also highlighted the concerns some have in curbing the influence of money in state judicial races. Thirty-nine states hold elections to determine who presides over their courtrooms.

In dissent, Chief Justice John Roberts said that the court's decision will undermine, not promote, an independent judiciary. His concern is that "probability of bias" is undefinable and will "inevitably lead to an increase in allegations that judges are biased, however groundless those charges may be."