Former president Mahinda Rajapaksa's attempt to stage a comeback in Sri Lanka's general election has ended in defeat as results on Tuesday showed the alliance that toppled him making decisive gains.
The ruling United National Party (UNP) fell just short of an outright majority, but Prime Minister Ranil Wickremesinghe should still command enough support to form a stable government after eight months of minority rule.
"I invite all of you to join hands," Wickremesinghe, 66, said in a statement. "Let us together build a civilised society, build a consensual government and create a new country."
The outcome is a victory for President Maithripala Sirisena, who beat his former ally Rajapaksa in a presidential election in January and called an early parliamentary vote to secure a stronger mandate for reforms.
That poll triumph triggered wild street celebrations, but this time Colombo was quiet - reflecting a sense that a difficult political transition was being completed rather than marking a new beginning.
Defeat for Rajapaksa will keep Sri Lanka on a non-aligned foreign policy course and loosen its ties with China, which during his rule pumped in billions of dollars to try to turn the Indian Ocean island into a maritime outpost.
Wickremesinghe's UNP doubled its representation to win 106 seats, final results showed, seven short of a majority in the 225-seat chamber. The alliance led by Rajapaksa's Sri Lanka Freedom Party (SLFP) took 95 seats after suffering heavy losses.
The UNP won 45.7 percent of the popular vote, ahead of 42.4 percent for Rajapaksa.
The outcome was welcomed by investors, who drove up local shares to seven-month highs on hopes that a stronger government would step up the pace of reforms and repair strained public finances.
"The policy stability created by the election result is positive and will reduce uncertainty," said Prithviraj Srinivas, an economist at HSBC.
Rajapaksa, a nationalist strongman, set his sights on becoming premier of an SLFP-led government but Sirisena, who succeeded him as party leader in January, ruled that out and purged Rajapaksa loyalists from senior posts.
A group of Sirisena followers is expected to cross the floor to join a broad-based national unity government led by Wickremesinghe, who was likely soon to be confirmed in the post.
"The UNP will have to look for coalition partners from those who support Sirisena," said Paikiasothy Saravanamuttu, head of the Centre for Policy Alternatives.
With outside support, the centre-right alliance could hope to muster the two-thirds majority required to pass proposed constitutional reforms that would make government more accountable and simplify Sri Lanka's complex election laws.
The power struggle between the past and present presidents overshadowed the election in a country with a history of political feuding that has often spilled over into violence and even the assassination of its leaders.
A backlash against Rajapaksa's attempt to win an unprecedented third term led support to coalesce around his former health minister Sirisena, a humble figure with none of the muscular bravado of his predecessor.
The 69-year-old Rajapaksa, now expected to lead a rump parliamentary opposition, told Reuters earlier he would "support good policies and oppose bad things".
Yet he could now be confronted with a judicial reckoning, along with two brothers who held high office, for alleged corruption and abuse of power during his decade in office. They have denied any wrongdoing.
"Mahinda has to compromise - resign from politics and parliament, and settle down as a former president - or face the legal consequences," said a Sirisena aide, who spoke to Reuters on condition of anonymity.