Sofiane Ghazi's murder trial ended almost as quickly as it began.

The Montreal man accused of stabbing his child, referred to in court as "Baby Ghazi," to death while still in the womb, pleaded guilty to second-degree murder as well as aggravated assault of his ex-wife at the Montreal courthouse Thursday.

It was the second day of the jury trial.

Ghazi was initially charged with first-degree murder and attempted murder in the stabbing of his ex-wife with a carving fork, who was 36 weeks pregnant.

The jury had heard that the mother was rushed to hospital and the child was delivered by emergency C-section following the July 24, 2017 attack. 

The couple was married for 12 years and had two other children, five and seven.

The wife kicked Ghazi out of the home because she felt he was high, but he came back and stabbed her 19 times.

Ghazi admitted that he abused hard drugs on the day of the attack.

Neighbours testified at the first day of the trial that they heard hysterical screams coming from the appartment, and the woman calling for help after being stabbed 12 times in the stomach and seven times in the upper thigh.

After the birth, the baby had a heartbeat for several minutes before succumbing to the injuries.

"Today we think of missus and her children," said crown prosecutor Chantal Michaud. "We hope that what happened today will help her continue to turn the page."  

A publication bans prohibits releasing the name of Ghazi's ex-wife and other children.

Ghazi's lawyer would not comment on why his client decided to change his plea.

Ghazi will likely receive a life sentence with no chance of parole for at least 10 years. Ghazi and his ex-wife intend to testify at the sentencing beginning Sept. 17.