Malaysia’s recent election marks a moment of genuine optimism for Asia. Too many governments around the region have slid backward of late toward corruption and incompetence. Mahathir Mohamad’s return as prime minister suggests a better path forward might be possible. But now the hard part begins.

Under Najib Razak, Malaysia’s once-impressive machinery of state eroded rapidly, battered both by rampant cronyism and a deeply entrenched system of ethnic preference. Mahathir faces many challenges reversing this trend. Along with many emerging Asian nations, Malaysia has long been stuck in a “middle income” trap. But it now must escape a “state capacity” trap, too.

State capacity has become something of a buzzword amongst policy makers trying to understand how countries develop. It underpins the work of MIT’s Daron Acemoglu and Chicago University’s James Robinson, whose celebrated 2012 book “Why Nations Fail” argued that good institutions support development, rather than other factors like geography or culture. The idea has since found widespread favor in bodies like the World Bank, as well as amongst influential thinkers like Arvind Subramanian, India’s chief economic adviser.

Worries about state capacity have risen in part because examples of weakness are so easy to find. Malaysia under Najib provided a raft of egregious case studies, most glaringly the swirling corruption scandal involving the 1Malaysia Development Berhad state fund. Najib has denied wrongdoing. Rodrigo Duterte, the Philippines’ strongman president, is busily undermining important parts of the Filipino state. Cambodia and Thailand have slipped back, too.

India’s example is in many ways even more worrying. The Indian state is weak at the best of times, but there is evidence that many of its more competent institutions — its Supreme Court, for instance, and its admired Election Commission — are also struggling, a point made by political scientist Milan Vaishnav at the U.S.-based Carnegie Endowment for International Peace.

These dispiriting national examples then illustrate a deeper truth. Economic development is often seen as a linear process, beginning in abject poverty and ending in prosperity, or what Francis Fukuyama has called the challenge of “Getting to Denmark.” In truth, however, development is more often an up-and-down ride, with periods of growth and reform followed by long stretches of stasis and reversal.

Much the same is true of state capacity. Research from political scientist Lant Pritchett and others has shown that of the world’s 102 “historically developing” states, only eight have managed to develop what he describes as “high capacity” governments. True, three of those — Brunei, Singapore and South Korea — are in Asia. But Pritchett’s bar is actually pretty low: a high capacity government, he suggests, is one with institutions roughly as good as those found in Uruguay.

Worse, it is all too common to see periods of rapid state capacity degradation. Almost no country has managed to follow Singapore and persistently improve its government, decade after decade. Between 1996 and 2012, for instance, Pritchett’s work shows that the quality of Malaysia’s state declined moderately, while the Philippines declined rapidly. Both countries’ performances over the last five years seems likely to have been even worse.

Part of the problem stems from a widespread misunderstanding about what state capacity actually means. At some level a well-functioning government does indeed need basic capabilities, such as the ability to fund and run an army, or to make the railways run on time. But as James Robinson argued at a conference I attended in India in mid-June, it also means a state that has popular legitimacy amongst its people.

States work better when their citizens, and in particular the powerful middle classes, voluntarily pay their taxes and obey laws without the need for expensive enforcement, because they view their government as acting broadly in the common interest. By contrast, government works less well when the elite is seen to be largely serving their self-interests, as was the case with the obvious venality of Malaysia’s ruling party over the last decade.

It is for this reason that China’s recent slide backward toward authoritarianism under President Xi Jinping is likely to lessen its state capability, even when its government appears to be outwardly impressive, especially in the area of new technology. “This isn’t all about whether the state can install clever facial recognition technology,” as Robinson put it. State capacity is typically strongest where citizens know that policies are inclusive and the machinery of state is not captured by a selfish upper-strata.

Leaders like Mahathir seeking to escape the state capacity trap must therefore look to make changes to the size and scale of their systems of public administration. Asian governments are typically lean, with a low ratio of spending to gross domestic product. Yet countries with high capacity tend to invest heavily in public goods, while also employing high-quality technocrats. In Malaysia, there are at least some promising signs from the appointments of Lim Guan Eng as finance minister and Tommy Thomas as attorney general, both admired figures.

But steps to demonstrate state impartiality and legitimacy over the longer term are vital, too. Rent-seeking and cronyism tend to emerge from government machines that favor one group over another, a deep-rooted problem in Malaysia in particular. Well-functioning states also tend to be neutral between different groups of citizens, ensuring that all abide by the rules.

Too often, Asian development is viewed in exclusively economic terms, most often as a linear path from agriculture to export-focused manufacturing and beyond. This view in turn seems compatible with a libertarian, limited state. But this vision of the ideal small state is now badly out of date. If Asia wants to develop, its governments need not be huge, but they must be good. Even at 92, Mahathir has a golden chance to show others how it can be done.