The Indiana Supreme Court has determined a judge wrongly considered the condition of the state's mental health system in rejecting an insanity defense for a man convicted of stabbing his grandmother to death in front of family members.In a 3-2 decision Wednesday, the justices said it was inappropriate for the judge to consider whether Gregory Galloway may have eventually been released if he was sent to a mental health facility.Instead, he was found guilty but mentally ill and was sentenced to 50 years in prison. If he had been found insane, Galloway would have been sent to a mental hospital instead of prison."It is not for the judicial branch to decide that a legally insane defendant should be convicted and sentenced to prison because of the condition of the state's mental health system," Justice Frank Sullivan wrote in the 23-page ruling. "While we sympathize with the difficulty of the trial court's decision, we cannot sustain it."The ruling didn't make clear whether Galloway would be entitled to a new trial. Bryan Corbin, a spokesman for the Indiana attorney general's office, said there likely would not be a new trial but that prosecutors could seek commitment proceedings.Corbin said prosecutors were looking at the option of seeking a rehearing from the Supreme Court.Two psychiatrists testified at Galloway's trial that he was legally insane when he straddled his grandmother, Eva Groves, 84, on a living room couch of the family's New Castle home in October 2007 and plunged a knife into her chest, saying she was the devil and was trying to kill him. He had gone shopping with her peacefully earlier in the day.A psychologist initially said he believed Galloway had been sane, but withdrew his opinion after learning that Galloway had been suffering delusions and had called his grandmother the devil.Galloway, who is now 38, had been in and out of mental institutions more than a dozen times since he was a senior in high school. Galloway was committed on at least 15 occasions, including once after his parents found him with a gun looking for his grandmother and saying he was Jesus Christ and she was the devil and another time in Tennessee after police found him driving a semitrailer full of gasoline and threatening to blow up a gas station.Family members had pleaded with doctors to keep him in hospitals on a long-term basis, but he was repeatedly released after a few days or weeks and then became worse again after he quit taking his medication, according to court documents."This case is as much a trial of our mental health system as it is of a man," Henry Circuit Judge Mary G. Willis said at Galloway's sentencing hearing in May 2009. She said the record was clear that Galloway posed a danger when he was not taking his medication, which he failed to do when he was not in an institutionalized setting."One of my options is not to say that he's committed for the rest of his life in a mental health institution. That would have been easy, but that's not one of my choices," Willis said.Chief Justice Randall Shepard and Justice Brent Dickson dissented from the decision, saying that Galloway had behaved ordinarily all day before the killing and had immediately regretted the murder. They said when Galloway is released from a mental hospital again, he will likely pose a threat to the public."The one thing we know for sure about Mr. Galloway is that he is in actual fact a danger to others," Shepard wrote.Willis declined comment on the Supreme Court's ruling Thursday. Galloway's attorney did not return a phone call seeking comment.Corbin said the state was reviewing options for seeking a rehearing and for civil commitment of Galloway.Chief Justice Randall Shepard and Justice Brent Dickson dissented from the decision, saying that Galloway had behaved ordinarily all day before the killing and had immediately regretted the murder. They said when Galloway is released from a mental hospital again, he will likely pose a threat to the public."The one thing we know for sure about Mr. Galloway is that he is in actual fact a danger to others," Shepard wrote.