Criminal proceedings were suspended and a mental competency evaluation ordered Tuesday for a man accused of attacking five transients in various San Diego neighborhoods, killing three of them.

At Jon David Guerrero's scheduled arraignment, Deputy Public Defender Dan Tandon told Judge Frederick Maguire that the defendant was “severely mentally ill'' and he doubted his client's ability to understand the charges against him.

The judge ordered the competency evaluation and scheduled a hearing for Oct. 7.

Deputy District Attorney Makenzie Harvey objected to the judge's decision, alleging that Guerrero demonstrated "extreme planning'' in the crimes and that he "was not a person suffering from a disorganized mind.''

Guerrero, 39, was charged last month with three counts of murder and two counts of premeditated attempted murder, along with a special circumstance allegation of multiple murders. He could face the death penalty if convicted.

During the hearing Tuesday, Harvey alleged Guerrero attacked all of his victims while the homeless men were sleeping, driving railroad spikes into their bodies and setting two of them on fire.

When Guerrero was arrested July 15, three railroad spikes and identification from two victims were found in his backpack, the prosecutor said. A search of the defendant's apartment turned up a bucket filled with rocks, railroad ties and railroad spikes, Harvey said.

San Diego police said the victims were brutalized as they slept on roadsides, in open areas and under freeway bridges.

The first attack in the series occurred July 3. About 8 a.m. that day, the burning body of Angelo De Nardo, 53, was found underneath an Interstate 5 offramp near the 2700 block of Morena Boulevard in Bay Park. A railroad spike had been driven into his head and chest, Harvey said. Witnesses described seeing a man running across the freeway near Clairemont Drive, carrying a gas can.

The following day, Shawn Mitchell Longley, 41, was found dead at a park in Ocean Beach and a railroad spike was found next to his body, the prosecutor said. That same day, 61-year-old Manuel Mason was severely wounded -- a railroad spike driven into his sinus cavity -- near Valley View Casino Center in the Midway district, Harvey said.

On the morning of July 6, Dionicio Derek Vahidy, 23, was gravely wounded in downtown San Diego by an assailant who fled after leaving a towel burning on top of him. A railroad spike was found next to the victim, who died in a hospital four days later.

Authorities have not released a suspected motive for the violence. There are no indications that the suspect knew the victims, according to police.

Click for more from Fox 5.