Dumb autocrats use the army, goon squads and guns to repress the opposition. Smart autocrats use the law courts to do it. Indonesia's Soeharto was a dumb autocrat. Singapore's Lee Kuan Yew and Malaysia's Mahathir Mohamad were smart autocrats.

The Lee-Mahathir model keeps the outward facade of a functioning democracy, with elections, a parliament and supposedly independent courts. Behind it, the systems are gutted to guarantee the ruling party remains ruling.

In Singapore, where Lee's People's Action Party has been in power for 50 continuous years, the government simply sues opposition politicians for defamation. A tame court hands down ruinous damages, opponents end up in bankruptcy, jail or exile.

When a meddlesome foreigner, the deputy director for Asia of Human Rights Watch, Phil Robertson, said last month that ''Singapore is the textbook example of a politically repressive state'', the government just shrugged and said: ''Singapore is a democratic state with a clean and transparent government.''

The army is in its barracks and there are no goon squads smashing through people's front doors at 3am. It's all legit, see? The foreign investors and governments play along. So what if the ruling party holds 98 per cent of the seats in parliament? It has an elected parliament, and surely that's good enough.

Lee quit the prime ministership in 1990 and now holds a personalised cabinet post of Minister Mentor. But his system lives on. His handpicked successors as prime minister, Goh Chok Tong, and now Lee's son, Lee Hsien Loong, have been every bit as smart as the old man himself in preserving the appearance of legitimacy.

In Malaysia, Mahathir was never as subtle or as smooth as Lee. But Mahathir was still a smart autocrat who kept control through his puppetry of the judicial system. The pivotal moment was in 1988 when Mahathir complained that the courts were ''too independent''.

He purged the chief judicial officer, the Lord President, and suspended the five chief justices of the Supreme Court. The court system has never given any further trouble to the Barisan Nasional, or National Front, since. Together with its predecessor, the BN has ruled Malaysia continuously for 54 years.

It's infinitely smarter to use legal instruments to purge judges than to use guns against protesters. A judicial massacre makes lousy TV. You won't see one live on CNN. So it remains hidden from international view. Yet it can be every bit as repressive. So when Mahathir faced a power struggle in 1998 with his deputy prime minister and heir apparent, the charismatic Anwar Ibrahim, he naturally turned to the courts to purge his younger rival.

In a blatantly political fix-up, he had Anwar arrested and charged with sodomy, a shocking crime in a predominantly conservative Muslim country. Even today it carries a maximum penalty of 20 years' jail. The police Special Branch concocted evidence and coerced witnesses. Anwar emerged from his police cell to appear in court with a bruised face, inflicted, it was later learnt, when the chief of police beat him.

The verdict was never in question. The courts convicted Anwar of sodomising his aide and speechwriter, Munawar Anees. The former deputy PM spent six years in jail. Munawar, now living in the US, has since said he was coerced into giving evidence against Anwar. ''My detention by the Malaysian Special Branch taught me how it feels to be forcibly separated from one's wife and children,'' Munawar wrote in the Wall Street Journal last month.

''How it feels to be searched and seized, disallowed to make phone calls, handcuffed, blindfolded, stripped naked, endlessly interrogated, humiliated, drugged, deprived of sleep, physically abused. What it's like to be threatened, blackmailed, hectored by police lawyers, brutalised to make a totally false confession.''

With Malaysia under tremendous international pressure from Anwar's admirers, including America's Al Gore and Britain's Gordon Brown, and with Mahathir retiring from the prime ministership in 2003, a review court overturned the sodomy sentence. Anwar was released in 2004.

He was allowed to return to politics in 2008 to lead the opposition to the BN. He committed the crime of doing so with some success. In March 2008, under challenge from Anwar, the BN won a national election, but was shocked to lose its prized majority of two-third of the seats in parliament.

The new BN Prime Minister, Najib Razak, reacted exactly as Mahathir had to a challenge from Anwar. Four months after the ruling party's election setback, Anwar was once again charged with sodomy. Once again, it's a blatant political case. The newspaper The Star called the case ''Sodomy II''.

Why is Anwar such a threat?

''At the moment,'' says Carl Thayer, an expert at the University of NSW, ''there is no other leader who can hold together the opposition coalition of an Islamic party with a Chinese party, who is capable of being prime minister, and who has experience and international recognition that Anwar has.''

The case is a joke. It exposes the Najib government as desperate and underhanded. It makes Malaysia a subject of international ridicule. While under Mahathir this form of legal manipulation might have been smart autocracy, in today's world it just looks like Malaysia is playing around with its national future.

Peter Hartcher is the Sydney Morning Herald's international editor.

This article appeared in Australia's The Age.