By Jim Melwert

EAST NORRITON, Pa. (CBS) — A former state cop pleads guilty to shooting and killing his pregnant wife in 2014, while she sorted baby clothes in the living room of their Montgomery County home three years ago.

Joseph Miller, 36, pleaded guilty to two counts of involuntary manslaughter. One count for his wife, Joanna Miller, who was six months pregnant when she was shot in the head. The second count for the child who died after an emergency cesarean section.

READ MORE: 4 Shot Inside Park City Center Mall, Lancaster Police Say

It happened March 7, 2014, but Miller wasn’t charged until earlier this year.

Miller was painting a room in the East Norriton home, preparing for the birth of their third child. His wife was in the living room sorting baby clothes.

READ MORE: 'Everyone Was In Pure Panic': Good Samaritans Rush To Shooting Victims' Aid At Park City Center Mall

Once done painting, Miller told police he got his gun and went into the living room to tell his wife he was going to the backyard shed to clean it.

Miller initially claimed he was 8 to 10 feet away from his wife when the firearm accidentally went off. He changed that to 2 to 4 feet. But charges were filed as prosecutors say additional testing showed the gun was 3 to 6 inches from her head when it was fired.

Miller was a seven-year veteran of the State Police. He was off-duty at the time of the shooting.

The couple’s two children are heard in the background of the 9-1-1 call.

MORE NEWS: Man In Critical Condition After Fairhill Shooting, Police Say

Miller faces a maximum of 5 to 10 years in prison when he is sentenced at a later date.