Punishments handed down by religious edict, or fatwa, have been outlawed by the Bangladesh High Court. The move comes after a series of cases of Muslim women being beaten and caned.
The court ruling came late Thursday on public interest litigations by human rights groups who highlighted examples of women being publicly whipped for "crimes" like adultery, having a child out of wedlock or even just talking to people of other faiths.
In some cases, rape victims were flogged for being a "participant" to their assault.
"The judges have ruled that all extrajudicial punishments in the name of fatwa, or religious edicts, are illegal and without lawful authority," the government's deputy attorney general Akram Hossain Chowdhury told AFP.
The ruling also provides jail terms for clerics or any members of village courts who order such punishments by invoking Islamic sharia law.
Human rights lawyer Shadeen Malik hailed what he described as a "landmark" ruling.
"The cases of beatings, whippings and public humiliations of people, especially poor rural women, would be drastically reduced following this verdict," Malik said.
"It states clearly that nobody has the power to inflict physical and mental torture to any person in the name of religion," he added.
There was no immediate reaction from the numerous Islamic parties in Bangladesh, which is 90 percent Muslim.