KUALA LUMPUR—A Muslim religious edict denouncing Halloween parties in Malaysia might not seem like a significant move. Plenty of Christian groups also view the commerce and frivolity that accompany the celebration as vaguely pagan and a little bit off-color.

But the role of Islam in public life is becoming a combustible issue here, driven on in part by the deepening conflict between government supporters and backers of opposition leader Anwar Ibrahim, whose trial on sodomy charges at the country’s highest court is gaining momentum.

Muslim leaders recently criticized a dog-petting event in Kuala Lumpur, accusing the organizer, himself a Muslim, as spreading un-Islamic practices. Dogs are considered unclean in some interpretations of Islam. Oktoberfest beer celebrations, while aimed at Malaysia’s large ethnic-Chinese and Indian populations, have also been criticized. The edict, or fatwa, against Halloween, posted on the “e-fatwa” website of the religious affairs ministry, warned that the day “cannot be celebrated by Muslims.”

A good portion of the broader controversy over Islam in Malaysia revolves around Mr. Anwar, 67.

While a Muslim himself, he is viewed with distrust by some Muslim conservatives who fear his blossoming multiracial opposition movement will open the door to a more liberal, pluralistic Malaysia where Islam—and the Malay majority—might lose its prestige.