PHILADELPHIA — The cousins started small — break-ins, jewelry heists and traffic violations — but on Friday they were charged in grisly crimes that ended with police unearthing the bodies of four young men, including a Loyola University Maryland student, from two pits buried deep on a sprawling family-owned farm.

Police found the missing men after a grueling, five-day search in sweltering heat and pelting rain, but it's still not clear why the 20-year-old suspects’ crimes escalated from petty offenses.

For Cosmo DiNardo, whose lawyer said he confessed to all four killings in exchange for being spared the death penalty, brushes with the law began in his early teen years. He was about 14 when the Bensalem Police Department first had contact with him. Over the next six years, he had more than 30 run-ins with its officers, department director Frederick Harran said.

A year and a day before he admitted to killing the missing men, including 19-year-old Loyola student Jimi Taro Patrick, setting three of them on fire and using a backhoe to load the charred bodies into an oil tank that he buried more than 12 feet deep on his parents’ farm, a family member had DiNardo involuntarily committed to a mental institution, Harran said. Details of his institutionalization remain unclear, but he was barred by law from owning a firearm afterward. Nonetheless, when Bensalem police responded to a report of gunfire in February, an officer found DiNardo in his truck with a 20-gauge shotgun and extra ammunition. He acknowledged his history of mental illness, Harran said.

DiNardo then enlisted his cousin, Sean Kratz, to help him rob 19-year-old Dean Finocchiaro, 22-year-old Mark Sturgis and 21-year-old Tom Meo, according to the police affidavit.

Court records show Kratz was previously arrested on two separate burglary charges in Philadelphia for thefts in June and December of last year in which he reportedly stole $1,000 in tools and $450 worth of jewelry. A week before the second theft arrest, Kratz was picked up for shoplifting $200 worth of clothing at a Macy’s near Philadelphia. Police say Kratz had been using pliers to cut off security tags. He pleaded guilty in June to retail theft after more serious charges were withdrawn.

With the Philadelphia cases still pending in January, court records show Kratz skipped bail and went to Illinois. That prompted a judge to issue a bench warrant for his arrest. Out on bail again, a prosecutor said Friday, Kratz became a killer.

Kratz, who said he works at a tiling company, did not have a lawyer with him at his arraignment. Clad in a blue jumpsuit and flanked by detectives, he told a judge that he has trouble walking because he'd been shot three months ago.