A SMALL island-country of 20m people, what significance does Sri Lanka have in international affairs? Oddly, quite a bit. As a democracy with a long history of decent social indicators, which began to liberalise its economy in the 1970s, Sri Lanka had long been touted—at least by the West—as a model for the rest of Asia. Then its long civil war, which only ended in 2009, drew scrutiny from distant powers, notably from North America and Europe, which are home to large Tamil diaspora. Tamil fighters made early use of suicide bombers, a grisly method later associated with Islamist extremists in other conflict zones. Last, under the increasingly autocratic nine-year rule of Mahinda Rajapaksa, Sri Lanka aligned itself with China. As diplomatic, economic and military ties with the rising Asian power got stronger, India grew ever more concerned that China intended to use its neighbour as a proxy.

Suddenly much has changed. Sri Lankan voters ejected Mr Rajapaksa in a presidential election on January 8th. Mr Rajapaksa was dismayed: according to Mangala Samaraweera, Sri Lanka's new foreign minister, as the results became clear the soon-to-be former president discussed whether he could call a state-of-emergency and scrap the election. The attorney-general, the head of police and the army commander all refused, and thus "saved the country", he says. By contrast, suggests Mr Samaraweera, the chief justice was ready to co-operate with the scheme to suspend democracy. (Mr Samaraweera should know what he is talking about: some years ago he was himself closely associated with Mr Rajapaksa's camp.)

The result itself was a complete surprise to many. Some now speculate that an Indian spy, a member of the Research and Analysis Wing (RAW), helped to co-ordinate Sri Lanka's disparate opposition factions to unite behind Maithripala Sirisena, the joint opposition candidate who is now president. One member of RAW, based at the Indian high commission in Colombo, the Sri Lankan capital, was sent home in December, during the election campaign. Quite what India did will probably not become clear, but it is obvious that politicians and diplomats in Delhi are delighted with the change of regime. Mr Samaraweera arrived in Delhi on January 17th, within days of becoming foreign minister, for a series of meetings with India's prime minister, Narendra Modi, the national security adviser, Ajit Doval, and an old friend, the foreign minister, Sushma Swaraj (he is pictured above, with Ms Swaraj).

In an interview with The Economist, Mr Samaraweera spelled out how he expects Sri Lanka's place in foreign affairs to change. For a start, warmer relations with India are all but guaranteed: he describes bilateral ties as "a state of irreversible excellence", with the "strained" relations that were experienced under Mr Rajapaksa an "aberration" that must now be forgotten. "We must put our friendship back on track...we must accept the geopolitical reality", he says. For India the most pressing concern is the heavy influence of China in its neighbourhood, especially after China deployed a military submarine, twice, to Colombo harbour in September. China has provided billions of dollars’ worth of loans and investment for Sri Lankan infrastructure, including a southern airport at Mr Rajapaksa’s hometown which Mr Samaraweera dismisses as a "white elephant". Such projects will now be reviewed, he says. Dubious Chinese activities—such as unsustainable tuna-fishing by Chinese boats in Sri Lankan waters—will presumably end.

Sri Lanka's ties with Europe and America had traditionally been excellent. A large share of its trade continues to be with the European Union. But under Mr Rajapaksa, who was accused of human-rights abuses at the end of the civil war, some of those relationships became antagonistic. Mr Samaraweera describes the former president as "vilifying" the West as a form of "hysterical nationalism to command” the vote of the ethnic Sinhalese majority, despite the fact that Western powers helped to crack down on international funding and support for the Tamil Tiger separatists towards the end of the war. Now, argues the new foreign minister, it is time for Western governments to re-engage Sri Lanka much more closely. He argues that they must regard his country as having its own "Burma moment". Myanmar (previously Burma) had been loyal to China while it was under military rule, but in recent years it has rebalanced internationally, reached out for investment and closer ties with India and the West—and been rewarded with high-profile visits and growing economic ties. Similarly, Sri Lanka is also pivoting back to take a friendlier position towards the West (Mr Samarweera is keen to emphasise there will be no hostility towards China) so the opportunity is ripe for stronger co-operation there. Mr Samaraweera will travel both to Washington, DC and to Beijing in coming weeks.

How quickly outsiders are ready to engage will depend in part on developments inside Sri Lanka, as the new government rolls out a 100-day programme and prepares for a parliamentary election, perhaps in May. Division between disgruntled northern Tamils and the majority Sinhalese will be watched closely by India (with its own much larger Tamil population) and by Western countries. Here, so far, there are reasons to be hopeful. Sri Lanka's new rulers are determined to weaken the over-powerful "executive president" post within weeks, which in turn will mean greater clout for parliament. A new civilian governor has been appointed to the Tamil-majority Northern Province, a longstanding demand of local politicians. Tamil leaders have agreed to join a new council to monitor developments in the north. And Mr Samaraweera says "we want to start giving the land back that was taken by the army" in the north, and to return it to the original owners.

As for accountability over the bloody events at the end of the civil war, when perhaps 40,000 Tamil civilians died, the new government's priority is to launch a credible domestic investigative process, rather than encourage the UN or other international actors to conduct one. One priority for Sri Lanka, given its newly rewarmed ties with India, will be to persuade its giant neighbour to oppose further inquiries by the UN's human-rights council. From its headquarters in Geneva, it is planning another assessment of the situation in Sri Lanka in March.

Mr Rajapaksa’s future remains unclear. Though the new president had promised not to pursue war-crimes prosecutions against his predecessor, the path is open for other legal measures. One option is to investigate whether the former president broke the law by considering a state-of-emergency. Mr Samaraweera denies that this would be tantamount to the approach taken by Pakistan's current prime minister, Nawaz Sharif, who has put his nemesis, Pervez Musharraf, on trial as a way of settling old political scores. A second, perhaps more plausible and popular legal option, would be to consider pursuing extensive corruption allegations against Mr Rajapaksa and his extended family. But Mr Samaraweera says that is entirely a matter for police and the courts to decide. However the courts, he concedes, will first have to regain their independence after years of political meddling.

In the eyes of Sri Lanka's new leaders, such as Mr Samaraweera, a remarkable transition—something like the Arab Spring or the "rainbow revolution" of coloured flags that swept some post-Soviet states last decade—has been experienced in the country: a looming autocracy was brought down and democracy restored. That, in brief, is a rare reason for cheer in global affairs. The movement is similarly rare for its non-violence, its democratic nature and the remarkable good will it has attracted from a wide variety of political actors involved. Now, Mr Samaraweera argues, it is for foreign partners—meaning especially India and the West—to engage more deeply, and realise that "Sri Lanka is again open for business". Old restrictions on foreign journalists have been lifted, and many Sri Lankan journalists who feared for their lives and fled into exile are being invited back. Censorship and repression have been scrapped, says the foreign minister, and Sri Lanka is eager to celebrate its democratic freedoms. Inevitably new tensions will arise, not least as the general election gets under way later this spring. But a chance exists for outsiders to assist Sri Lanka. India's Mr Modi, for one, is likely to want to make an early trip to the neighbouring country. Others will probably follow suit. Just what opportunity lies at the end of the rainbow may not be quite as golden as the greatest optimists claim today, but outsiders can help to support stability, democracy and cleaner government in the country. That would be a sharp improvement on what came before.