A Connecticut man pleaded guilty on Tuesday to killing his wife and seriously wounding his mother-in-law in a May 2014 attack, giving up a 16-month fight to prove his innocence.

Scott Gellatly, 47, faces 45 years in prison when he is sentenced on Nov. 17 for breaking into the Oxford, Connecticut, home of his in-laws and fatally shooting his estranged wife, Lori Gellatly, 32, and wounding her mother, Merry Jackson.

The shootings occurred while the couple's twins slept in an upstairs bedroom.

Gellatly, who had initially pleaded not guilty to charges including murder and attempted murder, changed his plea on Tuesday under a Connecticut law that allows a defendant not to admit guilt, but concede the state has enough evidence to secure a conviction if the case went to trial.

State's Attorney Kevin Lawlor told Superior Court Judge Frank Iannotti on Tuesday that family members supported the plea deal.

"This is a plea that avoids the uncertainty of a trial, and keeps him from being able to appeal," Lawlor said. "It also allows the victims' family to avoid a lengthy and painful trial, while sending the defendant to prison until he's 90 years old." 

Jackson, who survived the attack, cried with other family members inside the courtroom as Gellatly pleaded guilty, attorneys said.

Public defender David Egan said afterward that the plea agreement was a fair one. 

Had Gellatly been convicted of the charges during a trial, he faced up to 80 years in prison.