A Baton Rouge convicted felon pleaded guilty Tuesday in the 2012 slaying of his pregnant 21-year-old girlfriend and her unborn baby during a domestic dispute and was sentenced to 40 years in prison.

Adam Sterling’s plea came on the second day of jury selection at his trial on charges of second-degree murder, feticide and felon in possession of a weapon.

Sterling, 36, offered to plead guilty to manslaughter in the death of Shylah Hicks, feticide and the weapons charge, East Baton Rouge Parish District Attorney Hillar Moore III said.

“The plea offer was thoroughly discussed with the victim’s family. This plea and sentence was acceptable to the family,” he noted. “We are pleased with the outcome.”

Hicks was five months pregnant at the time of the shooting on Sept. 25, 2012. She was shot multiple times outside her home on Madison Avenue near 18th Street.

Sterling and Hicks had a history of domestic abuse and had gotten into arguments within two days of the shooting, police have said.

East Baton Rouge Parish Clerk of Court’s Office records showed no previous arrests of Sterling in his relationship with Hicks, but he was arrested in 2010 and accused of domestic abuse battery of another woman.

Sterling was accused of hitting that woman in the head and biting one of her ears before taking her keys and driving away in her car, according to an arrest warrant.

He pleaded guilty in that case to simple battery and was sentenced to six months in Parish Prison with credit for time served, court records indicate.