The deal that spared Cosmo DiNardo the death penalty in exchange for a murder confession in a case that's captivated the region and drawn national attention was lauded Friday by legal experts, who said the agreement was a swift and shrewd way to bring the gruesome case nearer to a close.

Cosmo DiNardo, 20, confessed to participating in the killings of four men. DiNardo also agreed to tell investigators where to find the bodies and lead them to an accomplice. In exchange for the cooperation, his defense lawyer Paul Lang said, prosecutors agreed not to seek the death penalty.

DiNardo's four victims, young men from Bucks and Montgomery Counties, disappeared last week. Their families' fears were confirmed when human remains were discovered in a 12-foot grave on a farm owned by DiNardo's parents.

On Friday, DiNardo was charged with murder and related offenses. Authorities also arrested his cousin and alleged accomplice, Sean Kratz, 20, on the same charges. And also Friday, they discovered the body of one of the missing men, Jimi Taro Patrick, 19, on the farm. The remains of Dean A. Finocchiaro, 19; Thomas C. Meo, 21; and Mark R. Sturgis, 22, had been discovered elsewhere on the sprawling property Wednesday.

Bucks County District Attorney Matthew D. Weintraub on Friday credited DiNardo's confession with implicating Kratz and leading investigators to Patrick's body, which had been buried separately from the others. "I'd like to think he wanted to help us get these boys home," he said, describing the cooperation agreement with DiNardo as critical to solving the case.

In interviews Friday, several legal experts agreed.

"It was absolutely the right thing to do," Jack McMahon, a former prosecutor who is now a prominent defense lawyer, said of the deal. "I think both sides did the right thing."

With evidence mounting in a case this serious, McMahon said, "the defense probably realized that the evidence against his client was pretty overwhelming. He had only one chip to play, and he used it to leverage for a life sentence."

Marc Bookman, a former public defender who is director of the Atlantic Center for Capital Representation in Center City, said the agreement had clear benefits for DiNardo and for prosecutors.

"In a case like this, there's a give and take," he said.

For the defense, Bookman said, "you've got four bodies. Any defense lawyer is thinking, 'There's no real defense to the killing of four people.' There are defenses to a murder case, but it's difficult to conceive of a legitimate defense to four bodies buried 12 feet in the ground."

The severity of the crime made it a clear candidate for a death penalty prosecution, legal experts agreed, giving the prosecution leverage and the defense reason to seek a deal.

"The defense is giving the prosecutor something compelling," Bookman said. "He said he would direct them to where the bodies are. You've got four grieving families who desperately want closure, however sad that closure might be. And he's asking for something in exchange."

For prosecutors, the threat of life on death row — if not actual execution in a state with a moratorium on the death penalty — upon conviction proved persuasive.

"It's good to have the death penalty for cases like this — whether you agree with it or not," said former Philadelphia District Attorney Lynne M. Abraham, whose tenure was marked by an aggressive willingness to pursue the death penalty in murder cases. "The prosecutor had a bargaining chip, and the defense attorney used it to bargain away [the possibility of] being on death row for 25 to 40 years."

Living conditions on death row are "horrendous," said Bookman, who has worked for years to overturn death penalty cases.

The deal DiNardo's lawyers reached with prosecutors spares the families of the four victims a painful trial and saves taxpayers the expense. In addition, Abraham said, it saves "hundreds of thousands, if not millions" of dollars spent on the appeals offered to all defendants convicted in capital cases. Those often go on for decades.

Dennis J. Cogan, a former prosecutor and veteran defense lawyer, called the agreement a "win-win." Without the confession, he said, the crime might have proved a "tough case" for prosecutors. With the deal Weintraub struck with DiNardo's lawyers, Cogan said, "they get the guy, they get the accomplice, and hopefully they bring closure for the families."

Other prosecutors have struck similar deals in previous high-profile cases.

In 2003, Gary Ridgway, the so-called Green River Killer, who pleaded guilty in 2003 to murdering 48 young women in the Seattle area, also successfully traded information in a bid to save his life. Prosecutors in Washington state agreed to take the death penalty off the table in return for Ridgway's cooperation. The transaction meant that investigators were able to link Ridgway to scores of additional murders.

Norm Maleng, the prosecutor who made the deal, said it brought relief to the families of victims. "This agreement was the avenue to the truth," he said. "And in the end, the search for the truth is still why we have a criminal justice system."

In another heavily publicized case, however, prosecutors made different decisions regarding the fate of serial killer Robert Lee Yates. In Washington state in 2000, one county prosecutor spared Yates' life in return for cooperation in finding the locations of the bodies of victims after he pleaded guilty to 13 murders. But in 2002, another county prosecutor sought and obtained a death penalty for Yates for two other murders. He remains on death row.

Ted Bundy, put to death in the electric chair in 1989, is believed to be responsible for a murder spree that investigators said took the lives of at least 30 young women across the nation. In his final months, his appeals exhausted, Bundy began to provide additional details about unsolved murders in what some saw as a bid to win a delay in his death. It was the called "Ted's bones-for-time scheme." No stay was granted.