MONTREAL -- A Quebec woman who pleaded guilty to infanticide must take a pregnancy test every six months, a judge ordered Thursday.

The 43-year-old woman pleaded guilty in November after her newborn baby was found in a plastic bag after she gave birth at home in July 2016.

The woman's lawyer said his client didn't know she was pregnant.

"It was a denial of pregnancy," Joseph La Leggia told reporters after the hearing at the Montreal courthouse.

"She did not know she was pregnant. She does not remember what happened. A complete amnesia."

The newborn was taken to hospital but died a few days later.

The accused was originally charged with murder.

Quebec court Judge Linda Despots sentenced the woman to 20 months to be served in the community as well as three years' probation.

La Leggia said it was the first time in Canada a judge had ordered pregnancy tests, but there was a similar court ruling involving a Calgary woman a few years ago.

The tests for the Quebec woman were a joint recommendation by the Crown and defence.

La Leggia said his client agreed to the measure.

Despots said a pre-sentencing report indicated the woman expressed guilt and sorrow over her actions. The judge added she is a low risk to reoffend.

The woman is not being named to protect her three other children, who were followed by youth protection workers and found to be happy and well-cared for, La Loggia added.

The Crown did not comment on the ruling.