The Supreme Court’s latest test of whether campaign contribution restrictions violate free-speech rights split the justices into familiar liberal and conservative camps.

And skeptical questions from Justice Anthony M. Kennedy, who probably holds the pivotal vote, did not bode well for Florida and 29 other states that forbid judicial candidates from directly soliciting campaign contributions.

Such restrictions are needed, the states contend, because judges are not like other politicians. The public expects judges to be impartial, the states argue, and that perception is compromised when candidates directly ask for money.

But Barry Richard, representing the Florida Bar Association, received sharp questioning from justices about whether Florida’s regulations are too porous to accomplish those goals.

While candidates may not directly solicit contributions, they may organize a committee to ask for money, direct the committee toward potential contributors, see who gave and even send thank-you notes.

Richard contended that the regulations work because Florida is attempting “to cut the direct link that creates the quid pro quo relationship by keeping . . . the judicial candidate from communicating directly with the person that he or she desires to receive the money from.”

“Unless it’s a thank-you note,” Justice Antonin Scalia responded. “I mean, once you say you can send a thank-you note, what you’ve just said is not true.”

Chief Justice John G. Roberts Jr., one of Richard’s toughest questioners, said he appreciated the difficulty Richard faced. Once Florida decided that at least some of its judges should be elected and thus allowed to raise money for campaigns, Roberts said, “you’re under a great burden in trying to figure out how you’re going to fix that without contravening the First Amendment.”

Richard agreed that Florida is trying to balance two constitutional interests. “One is the interest in free speech,” he said. “The other one is the undeniable interest, because it’s essential to a stable democracy, of having a judiciary which avoids both the reality and the appearance of corrupt influence.”

The challenge was brought by Tampa lawyer Lanell Williams-Yulee. When she announced her candidacy for a county judge’s seat in 2009, she sent out a mass mailing over her signature that said an “early contribution of $25, $50, $100, $250, or $500 . . . will help raise the initial funds needed to launch the campaign and get our message out to the public.”

She got no responses and eventually lost the race in a landslide to the incumbent.

But the Florida Bar took exception to her actions, saying the letter violated Canon 7C(1) of the Florida Code of Judicial Conduct, which bans direct solicitations. She was reprimanded and fined.

Justice Ruth Bader Ginsburg, whose questions were supportive of Florida’s efforts, said the state was responding to “a horrendous problem with corruption, and they wanted to get a handle on it.” Several justices of the state’s supreme court resigned following corruption scandals, including attempts to fix cases on behalf of campaign contributors. “So they made this small step,” Ginsburg said.

The liberal justices only fleetingly referenced Citizens United v. Federal Election Commission, the decision that freed corporations and unions to spend more on elections and marked a change in the court’s jurisprudence.

But they questioned Andrew J. Pincus, Williams-Yulee’s lawyer at the court, about why there could not be different rules for judicial candidates and candidates for other political offices.

Justices Sonia Sotomayor and Stephen G. Breyer noted that when judges make requests of lawyers, “the answer is yes,” as Breyer put it.

Justice Elena Kagan hypothesized about a “Judge Smith” who wrote to attorneys who had come before him, saying, “I hope I always will be fair, and you know I’m running for judge and I’d really like a contribution of a thousand dollars.”

Pincus noted that the exact same letter could be sent on Smith’s behalf by the person he designated to raise funds. “The difference in coercion there is really immeasurable,” he said.

Kennedy was mostly silent during the hour-long argument. He is the author of the Citizens United opinion — as well as another opinion that said judges must recuse themselves when campaign contributions raise the perception of bias.

When Pincus said there may be constitutional ways for states to regulate the fundraising behavior of judicial candidates — banning face-to-face solicitations, for instance, or allowing mass mailings but not individual ones — Kennedy said that would only complicate where to draw the line.

The justice seemed to suggest that Pincus should make no concessions, because trying to find the constitutional line might be “unworkable.”

The case is Williams-Yulee v. Florida Bar.