JAKARTA, Indonesia — The professor sang an old anti-army song at a rally outside the state palace in central Jakarta, Indonesia’s capital. After a video of his performance appeared online, the police arrested him this month for insulting a state institution.

A week earlier, a housewife in Surabaya was sentenced to 10 months in jail over four WhatsApp messages that a local company found insulting. She denied even sending the messages, which were in Javanese, a language she does not speak.

Both the professor, Robertus Robet, and the housewife, Saidah Saleh Syamlan, were charged under Indonesia’s sweeping online criminal defamation law, which allows anyone to file a complaint and carries a sentence of up to four years in prison.

Human rights advocates call the law overly broad and say it is used by government officials and influential people to stifle free expression.

Even so, rights advocates say the law remains a potent limitation on free speech because anyone can file a case with the police and a conviction can be based on flimsy evidence.

Sometimes the law targets a victim of abuse rather than the perpetrator.

A high school bookkeeper, Nuril Maknun, who recorded a lewd phone call from her boss that was circulated among a handful of people online, was sentenced in November to six months in jail for defaming him. She also spent two months in jail awaiting trial.

The use of criminal defamation is widespread in much of Southeast Asia, including in Myanmar, Singapore, Cambodia and Thailand, where governments often seek to limit public criticism. Human Rights Watch and Amnesty International have called for the repeal of all criminal defamation laws.

“For those with wealth and connections, hitting opponents with criminal defamation charges is a quick and easy way to seriously impair mounting public challenges and criticism,” said Phil Robertson, the deputy Asia director for Human Rights Watch. “In one fell swoop, an activist can lose their freedom, face damaging allegations difficult to refute and feel thoroughly intimidated.”

Civil defamation laws also are used in many countries to silence critics by imposing stiff fines or other financial penalties. But criminal defamation can land defendants in jail for years in addition to ruining them financially.

Mr. Robet, a longtime activist and a co-founder of Amnesty International Indonesia, took part in protests during the 1990s seeking to topple Suharto’s military government.