The justices, by a 7-2 vote, said states can give trial judges discretion to prevent someone from acting as his own lawyer if they are concerned that the trial could turn into a farce.
The decision comes in the case of an Indiana man who was convicted of attempted murder and other charges in 2005 for a shooting six years earlier at an Indianapolis department store.
Ahmad Edwards was initially found to be schizophrenic and suffering from delusions and spent most of the five years after the shooting in state psychiatric facilities. But by 2005, he was judged competent to stand trial.
Edwards asked to represent himself. A judge denied the request because he was concerned that Edwards' trial would not be fair. Edwards, represented by a lawyer, was convicted anyway and sentenced to 30 years in prison.
He appealed, and Indiana courts agreed that his right to represent himself had been violated, citing a U.S. high court decision from 1993. The courts overturned his conviction and ordered a new trial.
Thursday's ruling probably will lead to the reinstatement of the conviction.
"The Constitution permits states to insist upon representation by counsel for those competent enough to stand trial ... but who still suffer from severe mental illness to the point where they are not competent to conduct trial proceedings by themselves," Justice Stephen Breyer wrote in the majority opinion.
Justices Antonin Scalia and Clarence Thomas dissented. "In my view, the Constitution does not permit a state to substitute its own perception of fairness for the defendant's right to make his own case before the jury," Scalia said.