A South Carolina father facing a death penalty trial in the slayings of his five children exploded in a selfish rage after his son ruined an electrical outlet and then spent days driving around with their bodies, trying to figure out how to hide the crime, prosecutors said Tuesday,

But in the defense's opening statement, Timothy Jones Jr.'s lawyer said the computer engineer had schizophrenia and was insane — his thin grasp on reality broken by his ex-wife's infidelity, the struggle of raising five young children on his own and a feeling he was failing God.

Jones, 37, is charged with five counts of murder. Prosecutors said he killed 6-year-old Nahtahn in a rage after finding the boy, fascinated by electricity, had broken an outlet in their home near Lexington in August 2014.

Jones then strangled 8-year-old Mera and 7-year-old Elias with his hands and 2-year-old Gabriel and 1-year-old Abigail with a belt, prosecutor Shawn Graham said

"A father is supposed to love his children. Tim Jones loved himself more," Graham said in his opening statement, halted briefly when he appeared to choke up.

Authorities pieced together the case using Jones' own words to police, bizarre web searches on his smartphone and handwritten notes found in his SUV nine days after the killings, after he dumped the bodies on a rural hillside near Camden, Alabama, and a police officer at a Smith County, Mississippi, traffic checkpoint arrested Jones as his vehicle smelled "like death," Graham said.

But Jones' lawyer compared the father's mental state to a forest. He said there were some healthy trees, like a high-paying job, but almost all the other trees were diseased and fragile and exploded in a raging fire because of all the stress.

The problems started when Jones' ex-wife had an affair with a neighbor around the time she was pregnant with their fifth child and Jones won full custody of the children, defense lawyer Rod Madsen said.

Jones turned to drugs to medicate himself, which made his schizophrenia worse. He made bad financial decisions and took his kids' problems processing their parents' divorce as his own failings as a dad, Madsen said.

Jones was deeply religious, but while he could memorize verses of Scripture, he could not explain their application to life or what they meant, Madsen said.

"For him, it was a failure of faith. He must not be doing what the Bible told him to do," Madsen said.

After killing his children, wrapping their bodies in plastic and putting them in his SUV, Jones drove around aimlessly, listening to voices in his head, his lawyer said.

"He wasn't ready to let them go. He thought that was his way to spend time with them. He even played them songs," Madsen said.

Jones finally left their bodies after a voice told him to cut off one of his son's legs and he couldn't do it. "He said a prayer and said goodbye," Madsen said.

Graham said prosecutors are convinced that Jones knew right from wrong. He asked the jurors to listen carefully to the parade of mental health experts who will testify as the trial will likely stretch into June. Graham said they should weigh whether they are being told a fact that can be verified or something Jones told them.

"Are they trying to look for the truth, or are they looking for a defense or an excuse?" Graham said.

Jones' trial is being livestreamed from the Lexington County courthouse.

___

Follow Jeffrey Collins on Twitter at https://twitter.com/JSCollinsAP . Read his work at https://apnews.com/search/jeffrey%20collins