MIDDLETOWN, Conn. (AP) _ An angry mob shouted obscenities at a mental patient charged Monday in the fatal stabbing of a 9-year-old girl, and state officials tried to explain why he was able to walk away from a state hospital.

David Peterson, 37, was being held on $750,000 bond after his Superior Court arraignment on murder and weapons charges in the death of Jessica Short of Wallingford.

The girl was stabbed to death in front of her mother and dozens of other people Friday at a street fair in Middletown. The stabbing happened after Peterson slipped away from the Connecticut Valley Hospital, also in Middletown.

Two police sharpshooters perched on a neighboring rooftop provided additional security Monday while Peterson, in handcuffs and leg shackles, was hustled in and out of court under heavy guard.

Peterson appeared at the five-minute hearing with a public defender, and he told Judge Robert Burns that he understood his rights.

Burns ordered Peterson to undergo psychiatric evaluation to determine whether he is competent to stand trial. He is due back in court Aug. 14.

After the arraignment, between 35 and 40 people shouting obscenities ran alongside the police car that took Peterson away. Peterson was to be confined to Whiting Forensic Institute, a state hospital for the criminally insane in Middletown.

He could face up to life in prison if convicted of murder.

State Mental Health Commissioner Michael F. Hogan called the stabbing ''the most devastating event in the hospital's 100-year history,'' but insisted that proper procedures had been followed at Connecticut Valley Hospital.

Hogan said Peterson was not allowed to leave the building where he was assigned. But on Friday, Peterson apparently slipped away from the hospital's unfenced campus and took a bus downtown.

According to a hospital report, other patients saw him on the bus and asked why he wasn't at the hospital. He told them he was out on a day pass.

Peterson bought a $37 hunting knife at a sporting goods store, then attacked Jessica moments after she walked out of the F.W. Woolworth store nearby, authorities said. She was stabbed repeatedly in the face and neck.

''In the wake of this incident, we must conclude that tightening security for forensic patients is necessary,'' Hogan said.

Patients are granted privileges under a five-step program in use for years at the hospital in this central Connecticut city 15 miles south of Hartford.

From now on, any changes recommended by a patient's treatment team will be reviewed by a forensic psychiatrist, Hogan said.

''This system has worked well for thousands of patients over many years and is used in many hospital, but there is no question that it did not work in this case to prevent a horrible occurrence,'' the commissioner said.

Peterson was confined to the hospital last year for up to 15 years after he was found innocent by reason of insanity on assault and burglary charges.

Peterson's first run-in with the law came after he stabbed a fellow student at Wethersfield High School in 1971. After that he was in and out of state mental hospitals several times, said his sister-in-law, Ellen Peterson.

In 1987, Peterson was arrested again and convicted of stabbing a man at a boarding house where he was staying.

Funeral services for the child were scheduled for Tuesday.