DOYLESTOWN, Pa. — They were linked in ways that connect many young men recently out of high school and without a sure path in college or career — by construction jobs, an interest in all-terrain vehicles and vintage sneakers — and also, it seemed, by an appetite for marijuana.

And then a fairly common journey that turned into an unfathomable one finally became clear on Friday when two 20-year-old men confessed to the murders of four young men who disappeared in the suburbs of Philadelphia last week, authorities said on Friday.

Officials claimed that the suspects lured the victims to a remote family farm in northern Bucks County with the promise of drug deals, shot them, ran one of them over with a backhoe, and burned three of the bodies in a “pig roaster.”

The initial suspect, Cosmo DiNardo, was arrested days ago on lesser charges and confessed to the killings on Thursday, according to one of his lawyers. Police complaints filed against the defendants on Friday said Mr. DiNardo told investigators that he had an accomplice, Sean M. Kratz, identified in the complaints as his cousin.