KUALA LUMPUR, Malaysia — A Malaysian Muslim woman facing six strokes of the cane for drinking beer will instead perform a community service for three weeks on the Sultan of Pahang’s order, her attorney said Thursday, ending months of uncertainty over the punishment.

The letter from the sultan was received Wednesday and Kartika Sari Dewi Shukarno, 33, and her family, have been informed about it, Adham Jamalullai Ibrahim said Thursday. The letter said the punishment will replace the caning sentence, Shukarno Abdul Muttalib, Kartika’s father, said separately.

Kartika, a mother of two children, was ordered to be caned last July after an Islamic court found the former model guilty of breaking a law that forbids Muslims from drinking alcohol.

The Sultan’s decision to replace the caning came after months of protests by women and human rights groups and debates over whether conservative Muslims are gaining influence in the predominantly Muslim Asian nation. Malaysia has a dual-track judicial system where Islamic courts operate alongside civil institutions.

On Feb. 9, Malaysian authorities flogged three Muslim women convicted in the shariah court of having sex outside marriage, drawing the anger of human rights groups. The three women were caned following shariah guidelines under which the punishment is delivered by a female prison warden.