A 22-year-old former community college student admitted Friday to conspiring with his then-girlfriend to rob his pot dealer, and then killing the man when the when the plan went awry.

Joseph Villani pleaded guilty to aggravated manslaughter, conspiracy to commit armed robbery, armed robbery, disturbing human remains and witness tampering in the death of 29-year-old Trupal Patel, whose body was found in Shark River Park in Wall Township on Feb. 22, 2017.

Villani faces up to 40 years in state prison when he is sentenced on March 21. Villani’s attorney, Edward C. Bertucio, said he plans to fight for a lesser sentence.

“This will ultimately rest in your discretion,” Bertucio told Monmouth County Superior Court Judge Joseph W. Oxley.

Prosecutors also want Villani to pay the approximately $22,000 funeral costs for Patel. Bertucio argued his client doesn’t have the means to pay those costs.

The plea deal comes months after his former girlfriend and co-defendant, Raquel Garajau, was found guilty by a jury of murder and other offenses. The 21-year-old former honor roll student faces 30 years to life in prison on the felony murder charge.

Raquel Garajau, 21, appears in court on June 5, 2017. (Rob Spahr | NJ Advance Media for NJ.com)

Villani was awaiting the start of his trial when the plea deal was reached. Bertucio declined to comment after the hearing on why his client decided to take a plea deal instead of go to trial.

Villani admitted to hatching a plot with Garajau to meet Patel, a Brick resident, in the garage of his Ocean Township home and steal his marijuana on Feb. 6, 2017.

According to an indictment, Villani and Garajau established a relationship with Patel after a person told Villani about how much cash Patel had. Villani knew Patel and had previously purchased marijuana from him, according to police documents.

Villani admitted to placing a semi-automatic rifle outside of the door leading to his home in case there was a physical altercation.

A fight between the two broke out, and Villani admitted to shooting Patel three times with the gun he retrieved from behind the door. Villani then stole Patel’s Movado watch, money and an unspecified amount of marijuana, which he and Garajau then sold.

Villani enlisted the help of two friends to ditch Patel’s black Jaguar in nearby Asbury Park and to dump Patel’s body in Shark River Park.

The friend who helped move the car would go on to cooperate with authorities and record a conversation with Villani in which he told the friend to lie to investigators about moving Patel’s car, according to the factual statement made by Bertucio.

Garajau was also present with Villani when he encouraged the friend to lie to police, Villani acknowledged.

Villani sat in the jury box during the proceeding. He blew a kiss to his parents, who were seated in the third row of the courtroom, before he was escorted away by sheriff’s officers.

The only thing he said was "yes” to his attorney’s questions about his role in the crime.

Garajau intends to appeal her conviction. Her attorney, Robert A. Honecker Jr., told reporters outside the courtroom he will move forward with the appeal despite Villani’s plea.

“I’m not surprised Mr. Villani pleaded guilty,” Honecker said. “He was the bad guy in this case.”

Trupal Pate, 29, of Brick. (submitted photo)

Patel’s mother, Rita, was also in attendance. She did not speak during the proceeding, but told reporters afterwards she thought justice was served and that the deal was fair.

Patel was born in India but raised in New Jersey, his obituary states. He had a passion for cars and enjoyed watching shows on history and technology.

“He will be remembered as a thoughtful, fun and loving person who would put a smile on one’s face and would help others out before helping himself,” his obituary said.

Alex Napoliello may be reached at anapoliello@njadvancemedia.com. Follow him on Twitter @alexnapoNJ. Find NJ.com on Facebook.

Have a tip? Tell us. nj.com/tips