AFTER centuries of absolute monarchy followed by decades of chaos, Nepal is taking to democracy in a big way. Since May its people have voted into office 753 newly created local councils, seven new provincial assemblies and a 275-member national parliament. Counting is not quite done for those last two votes, run simultaneously over the past three weeks, but the winner is clear. A coalition of two ostensibly communist parties, the Unified Marxist Leninists (UML) and the Maoist Centre, looks set to control not just the national government but six of seven provinces.

The alliance was tapped to win after the Maoists abruptly ditched their erstwhile coalition partner in the outgoing government, the Nepali Congress, to join the UML. But the scale of the avalanche comes as a shock to the centrist and liberal Congress, which over the turbulent past quarter-century has served as the default party of government. The leftists captured 70% of the 165 seats allocated on a first-past-the-post (FPTP) basis, compared with a meagre 14% for Congress. (Calculations are still under way for the remaining 110 seats, which will be allotted proportionally.)

Congress’s drubbing might not be a bad thing. Nepal’s communists differ more in brand than in ideology from other parties, and many Nepalese would welcome any outcome that shakes up the ruling class. Other notable losers include the royalists campaigning for a Hindu state, who took just one FPTP seat, and a splinter Maoist group which let off bombs to disrupt the elections. A clutch of new parties marketed as alternatives to the old corrupt ones failed miserably.

The campaign itself was a dull affair that thankfully lasted a few short winter months. The communists succeeded largely due to fatigue with Congress, better organisation and a campaign that sold promises of development in the form of shiny new infrastructure. None of the main parties put such chronic problems as discrimination against Dalits, women and other marginalised groups on their agendas. Neither the plight of public schools and hospitals nor the lack of good jobs, which drives Nepalese to seek work abroad, featured in their rallies. Millions of migrant workers in India, the Middle East and elsewhere, whose remittances are equivalent to 30% of GDP, were not allowed to vote despite a Supreme Court ruling that theoretically gave them that right.

Still, the results signal a likely return to relative political stability after a decade of war and another decade of disruptive political jockeying. The constitution of 2015 does not allow a no-confidence motion for two years, and the new government looks likely to survive a full five-year term. The communist coalition plans to unite into a single party as soon as the right deals are in place. These include finding appropriate posts for the five former prime ministers in the coalition who won seats, and deciding the composition of the six leftist provincial governments.

The elections also reveal the divide created by the new constitution. The only province that did not turn left, number two (provincial names and capitals have yet to be decided), was easily won by parties representing the Madhesis, lowland people seeking to change a political system said to favour the country’s highlands. Their promise to fight hard to amend the constitution, as well as further demands for greater local rights from other parts of the multi-lingual, multi-ethnic and multi-religious country, could augur trouble, unless the communists shed their victors’ hubris to accommodate the Madhesis and other marginalised people.

Internationally, the communist government will have to refine its diplomatic skills to keep both its giant neighbours happy. Ties with India are stronger thanks to an open border, which has fostered trade and allowed millions of Nepalese labourers to find work there. But the new government will be the friendliest to China since that of Gyanendra Shah, Nepal’s last king, who courted the Chinese authorities eagerly in 2005 in an unsuccessful effort to prolong his dictatorship.

The person most likely to return as prime minister, K.P. Oli, is keen to see greater engagement with China. He was prime minister in 2015 when India appeared to side with Madhesi agitators who were attempting to blockade Kathmandu, the capital. In response Mr Oli signed trade and transit agreements with China. In the election he projected himself as a man able to stand up to a domineering India.

For years Nepalis have envied India’s and China’s rapid economic growth and tried to woo investment from them. Political turbulence has stymied many projects. One of the last acts of the outgoing government was to scrap a big Chinese-backed hydroelectric scheme. The new government is likely to present China with a wish-list of investments, including airports, highways, dams and a high-altitude railway to connect Kathmandu to Tibet. This passage through the Himalayas would make Nepal less dependent on India. But Nepalese democrats worry that Chinese politics will steam in along with the money, encouraging Nepal’s rulers to mimic China’s approach to dissent.