Chief Justice John G. Roberts Jr. told law students Tuesday that he found it “very troubling” to be surrounded by loudly cheering critics at President Obama’s State of the Union address, saying it was reason enough for the justices not to attend the annual speech to Congress.

“To the extent the State of the Union has degenerated into a political pep rally, I’m not sure why we are there,” Roberts said at the University of Alabama School of Law.

Obama’s speech in January came a week after the high court ruled 5 to 4 that corporations had a free-speech right to spend unlimited sums to elect or defeat candidates for office.

The president, looking down at the six justices in attendance, sharply criticized the Supreme Court for having “opened the floodgates for special interests” to sway elections.

Senate Democrats rose to their feet, applauding and cheering the president’s comments.

When asked about this Tuesday, Roberts said the criticism itself did not bother him.

“Anybody can criticize the Supreme Court. . . . I have no problem with that,” he said. He objected to criticism in such a public setting, where the justices had no choice but to sit silently.

“The image of having the members of one branch of government standing up, literally surrounding the Supreme Court, cheering and hollering while the court -- according to the requirements of protocol -- has to sit there expressionless, I think is very troubling,” he said.

“It does cause me to think . . . why are we there?”

Three justices -- John Paul Stevens, Antonin Scalia and Clarence Thomas -- did not attend this year’s State of the Union. Both Scalia and Thomas have said they believe the speech has become a partisan pep rally that the justices should avoid.

When Obama voiced his criticism, Justice Samuel A. Alito Jr. shook his head slightly and appeared to say, “Not true.”

Responding to Roberts’ comments Tuesday night, White House Press Secretary Robert Gibbs said in a statement, “What is troubling is that this decision opened the floodgates for corporations and special interests to pour money into elections, drowning out the voices of average Americans.”

Roberts also took issue with the Senate’s confirmation process for judges and justices, saying it is contentious and unproductive.

“I think the process is broken down,” he said. “The only people who can change it are the senators. I hope they do.”

david.savage

@latimes.com