A onetime North Dakota prosecutor agreed Thursday to plead guilty to fatally beating his ex-wife in his Minnesota home last summer as she clutched the youngest of their five children.

Anders L. Odegaard, 32, of Warren in northwestern Minnesota, pleaded guilty in Marshall County District Court to second-degree unintentional murder in the death of 31-year-old Carissa Odegaard on Aug. 23.

Under a plea agreement, a second-degree intentional murder count was dropped and Odegaard will be sentenced to a term of 18 years and four months.

With credit for time in jail since his arrest, he is expected to serve about 11 years and four months in prison and the balance on supervised release. Sentencing is scheduled for Aug. 15.

Odegaard entered what is known as an Alford plea, meaning he maintained his innocence but acknowledged there was ample evidence to convict him.

County Attorney Donald Aandal said at the time charges were filed that Odegaard "was exercising parenting time" and his former wife was picking up their children for church when the assault occurred.

According to the criminal complaint, Carissa Odegaard was holding the youngest of the children, a 3-year-old boy, during some of the attack.

Anders Odegaard was appointed state's attorney in Mercer County, N.D., in June 2021 but fired three months later, a state's attorney official said. He then worked as a public defender in Stark County, N.D., but again was fired after three months, according to the official. After a brief time in private practice in Bismarck, N.D., he moved to Warren.

Carissa Odegaard of East Grand Forks filed for divorce in April 2021, and it was granted six months later. Their five children, four boys and a girl, ranged in age from 9 to 3.

When the divorce decree took effect, the filing noted, Anders Odegaard was deeply in debt. He owed $103,180 in student loans, $22,650 on a personal loan and $32,750 in credit card debt in his name and $34,590 in credit card debt in both their names.

He also was obligated to pay Carissa Odegaard $1,983 a month in child support and was ordered by the court to pay her $11,298 to cover the time since they separated until the divorce took effect. A court hearing on their divorce had been scheduled for a week after her death.