WASHINGTON  In Supreme Court arguments on Tuesday, most of the justices seemed convinced that conditions in California’s prisons are so awful that they violate the Constitution.

But it was not clear that a majority was ready to endorse an order by a special three-judge federal court there requiring state officials to reduce the prison population by as many as 45,000 inmates over two years, to address what it called longstanding constitutional violations in medical and mental health treatment.

Justice Stephen G. Breyer said the conditions documented in court papers were horrendous.

He referred, for instance, to a passage in one brief describing prisoners “found hanged to death in holding tanks where observation windows are obscured with smeared feces, and discovered catatonic in pools of their own urine after spending nights locked in small cages.”

But Justice Anthony M. Kennedy, whose vote may determine the case, said the special court’s math seemed arbitrary, and Justice Samuel A. Alito Jr. said he feared a rise in crime should large numbers of prisoners be released.