The man accused of killing five of his relatives two years ago in Brooklyn, including four children, has pleaded guilty to murder and manslaughter charges.

Mingdong Chen, 27, pleaded guilty to three counts of second-degree murder and two counts of manslaughter. He faces 25 years to life for each murder.

Police say Chen used a kitchen knife to slash the throats of his cousin's wife and her four children in Sunset Park in October 2013.

He told police he envied the success of fellow Chinese immigrants.

The prosecution says by pleading guilty, it spares the family of having to go through a trial.

"The court's decision, as I said in court, takes him out of society," said Brooklyn Assistant District Attorney Mark Hale. "He'll die in jail. That was the idea, the ultimate goal, for public safety and for the severity and the horrific nature of this crime."

Chen is due back in court for sentencing on October 20.