A New Jersey man stuck in a love triangle killed his 20-year-old romantic rival during a night of jealousy and rage that culminated in his pleading guilty to murder this week.

Alan McGinnis, 27, pleaded guilty to first-degree murder in the death of Cody MacPherson, revealing during a plea hearing Monday that he stabbed the victim in the chest and neck inside a Pemberton home and shoved his body in the trunk of his car on September 24, 2017, Ocean County prosecutor Bradley Billhimer told the Asbury Park Press on Tuesday. McGinnis faces 30 years in prison without the possibility of parole.

MacPherson's remains were found six months after the crime and — after a collaborative investigation between agencies within the state — McGinnis was arrested a month later. A grand jury indicted him in August.

THREESOME TWIST REVEALED DURING TESTIMONY IN DENISE WILLIAMS MURDER TRIAL

McGinnis' odd behavior after the fatal stabbing of Macpherson — including nonchalantly asking his cousin on the day of the murder for a tool to hide the body — was revealed by investigators.

“Hey, do you have a shovel? I have a body in the trunk," Michael Weatherstone, a supervising assistant Ocean County prosecutor, recalled McGinnis asking his relative during an April hearing, according to the newspaper. He later dumped MacPherson's body in a wooded area about a mile away in Jackson.

Weatherstone said MacPherson had been romantically involved with McGinnis’ ex-girlfriend and mother of his two children, Caitlyn Huertas, who was passed out on a couch after drinking on the night of the murder. Huertas and McGinnis also had an intimate relationship around that same time, a probable cause affidavit obtained by Patch in July states.

FLORIDA WOMAN ACCUSED OF PLOTTING HUSBAND'S DEATH, MARRYING KILLER STANDS TRIAL

“He was aware they had slept together in [a] motel the night of Sept. 22 to Sept. 23," Superior Court Judge Guy P. Ryan said during an earlier hearing.

According to the affidavit, McGinnis told Huertas' relatives that he killed MacPherson "because he was no good for [her] and believed that Cody was responsible for her being an unfit mother."

McGinnis will remain in Ocean County Jail while he waits to be officially sentenced.