He said it could be a mistake to impose the death penalty for rape because both the attacker and the victim 'might have enjoyed' it.

The remark reportedly drew laughter from panel members. Sunusi later apologised and said he had been joking.

Not only was Sunusi rejected for the
job, but the country's Judicial Commission recommended that he be dismissed from his position on the South Sumatra high court.

But the supreme court would have to
agree, and it has said such punishment would be too severe because he
made the remark in an interview, not during a trial.

Husein Muhammad,of
the commission on violence against women, said: 'Enough is enough!

'Our officials should no
longer mess around and issue ridiculous statements even as a dumb joke.'

Women in the social-media-obsessed country have been rallying, online and on the streets, against sexists comments and attacks on women for some time.

The movement in a country of 240 million people, most of whom practice a moderate form of Islam, appears to be having some impact on the largely secular government.

Husein Muhammad added: 'We are living in a different era now. Now we have supporting laws and social media to bring severe
consequences and social sanctions.'

But rights groups argue the country remains far behind on many issues involving gender equality and violence. Rape cases often are not properly investigated, and victims are sometimes blamed.

In 2011, after a woman was gang raped on a minibus, then-Jakarta governor Fauzi Bowo drew protests after warning women not to wear miniskirts on public transportation because it could arouse male passengers. Bowo lost his re-election bid last year.

A sex-trafficking case involving a 14-year-old girl prompted education minister Mohammad Nuh to say last year that not all girls who report such crimes are victims.

He said: 'They do it for fun, and then the girl alleges that it's rape.'

His response to the criticism he received was that it's difficult to prove whether sexual assault allegations are 'real rapes.'

Changing views: The fact both officials are at risk of losing their jobs shows a change in attitudes in Indonesia

Growing concern in Indonesia over women's rights reflects that in India, where a brutal and deadly New Delhi gang rape in December has drawn nationwide protests and demands for change. That case also resonated in Indonesia.

'Let's imagine the suffering of women who are treated badly by their husbands and the rape victims. What if it happened to our own families?' said Ellin Rozana, a women's rights activist in Bandung, capital of West Java province.

'We need government officials who will be on the front line to protect women, and judges who can see that violence against women is a serious crime.'

In the West Java official's case, it was the text-message divorce that prompted outrage more than his unregistered second marriage, though such weddings raise issues about women's rights.

They are regularly performed for Indonesians ranging from poor rice farmers to celebrities, politicians and Muslim clerics.

Polygamy remains common in many Muslim countries, based on Islamic teachings that allow men to take up to four wives.

In Indonesia, men are allowed to marry a second wife only after the first gives her blessing. Since most women refuse to agree to share their husbands, unregistered ceremonies, or 'nikah siri,' are often secretly carried out by an Islamic cleric outside the law.

Women's rights: Protesters in Garut, West Java, demanded in December that Fikri is sacked over the divorce

Some of the marriages are simply a cover for prostitution. A cleric is paid to conduct 'contract marriages' as short as one night in some parts of Indonesia, usually for Middle Eastern tourists.

Practices differ slightly elsewhere, with men in places such as Malaysia sometimes marrying outside the country to avoid informing existing spouses and seeking permission from an Islamic court.

Ceremonies in Iraq are often held in secret for the same reason. No approval is needed in the Palestinian territories, but contract marriages are banned.

Without a marriage certificate, wives lack legal rights. Children from the marriage are often considered illegitimate and are typically not issued birth certificates, creating a lifetime of obstacles ranging from attending schools to getting a passport.

However, in another sign of Indonesia's changing attitudes, the supreme court this month ordered all judges to obey an earlier constitutional court ruling granting rights such as inheritance to children born out of wedlock, and to punish fathers who neglect them.

The women's commission on violence is now pushing for a revision of Indonesia's 1974 marriage law to grant more protections to women and children.

'I hope Indonesian women can take a lesson from Fikri's case,' said Ninik Rahayu of the commission.

'At least it has awakened their awareness to not marry in an illegal way.'