Morocco’s king pardoned Hajar Raissouni, a journalist for an independent newspaper who was sentenced to a year in prison for an abortion that she denied having, the country’s ministry of justice said on Wednesday.

The ministry characterized the pardon as an act of “compassion and mercy,” saying that King Mohammed VI wanted to “preserve the future of the two fiancés who planned to found a family in accordance with religious precepts and the law.”

But human rights advocates said that Ms. Raissouni’s conviction was unjust and politically motivated, and that it exemplified the state’s persecution of independent journalists. The king also pardoned her fiancé, two doctors and an office assistant.

The case sparked weeks of outrage in the North African kingdom, with many speaking out in defense of press freedoms and others asking for reforms to the penal code . Ms. Raissouni and her fiancé, Rifaat al-Amin, had been sentenced to one year in prison.