DOYLESTOWN, Pa. — A week after four young men disappeared in the suburbs of Philadelphia, and one day after investigators found human remains buried on a nearby farm, the son of the farm’s owners confessed to killing all four, his lawyer said on Thursday.

The man who confessed, Cosmo DiNardo, 20, knew the victims and had been described by the authorities as a “person of interest” in the disappearances. Prosecutors had filed lesser charges against him this week to put him in jail while they investigated the disappearances.

Officials gave no indication of a motive for the killings, but Mr. DiNardo, who suffered from mental illness, has had multiple run-ins with the local police, and an acquaintance said he had talked about killing people.

“Mr. DiNardo this evening confessed to the district attorney to his participation or commission in the murders of the four young men,” one of his lawyers, Paul Lang, told reporters late Thursday outside the Bucks County Court of Common Pleas. “In exchange for that confession, Mr. DiNardo was promised by the district attorney that he will spare his life by not invoking the death penalty.”