A Burlington County man has admitted to slaying his romantic rival and dumping his body in the woods in 2017, an admission that will leave him behind bars for the next 30 years.

Alan McGinnis, 27, pleaded guilty to first-degree murder for the killing of 20-year-old Cody MacPherson.

Before he went missing, MacPherson was last reported at the Browns Mills home of a woman he was romantically involved with.

Investigators say the woman was the mother of McGinnis' two children — an affair that McGinnis was aware of and condoned until the woman chose MacPherson.

McGinnis admitted to stabbing MacPherson in the neck and chest at a home in Pemberton Township on Sept. 24, 2017. He also admitted to putting MacPherson's body in the trunk of a car and dropping it in a wooded area in Jackson.

Alan McGinnis pleaded guilty to murder. (Ocean County Jail)

It would be almost seven months before MacPherson's body was found by a fire warden with the New Jersey Forest Fire Service during a controlled burn the following March. At the time of his arrest, police said McGinnis had returned to the wooded area a week after killing MacPherson to destroy evidence and also cleaned the home where MacPherson was last seen to remove any blood and other evidence.

McGinnis was also charged with kidnapping, possession of a weapon for an unlawful purpose, unlawful possession of a weapon, improper disposal of human remains and destruction of evidence.