Sri Lankan president Gotabaya Rajapaksa submitted a letter of resignation on Thursday, a spokesperson for the parliament speaker said, hours after fleeing to Singapore following mass protests over an economic meltdown.
The announcement triggered jubilation in the commercial capital Colombo where protesters massed outside the presidential secretariat, defying a city-wide curfew.
Crowds set off firecrackers, shouted slogans and danced ecstatically at the Gota Go Gama protest site, named mockingly after Rajapaksa's first name.
"The whole country will celebrate today," Damitha Abeyrathne, an activist, said. "It's a big victory."
"We never thought we would get this country free from them," she added, referring to the Rajapaksa family who dominated the South Asian country's politics for two decades.
Rajapaksa submitted his resignation by email late on Thursday and it would become official on Friday, once the document had been legally verified, the speaker's spokesperson said.
Rajapaksa fled to the Maldives on Wednesday then headed on to Singapore on Thursday on a Saudi Arabian airline flight, according to a person familiar with the situation.
The Maldives government confirmed late on Thursday that the country had granted diplomatic clearance for a Sri Lanka Air Force aircraft that carried President Gotabaya Rajapaksa and his spouse, on a transit visit.
A passenger on the flight, who declined to be named, told Reuters that Rajapaksa was met by a group of security guards and was seen leaving the airport VIP area in a convoy of black vehicles.
Airline staff on the flight told Reuters the president, dressed in black, flew business class with his wife and two bodyguards, describing him as "quiet" and "friendly".
Singapore's foreign ministry said Rajapaksa had entered the country on a private visit, and had not sought or been granted asylum.
Rajapaksa's decision on Wednesday to make his ally Prime Minister Ranil Wickremesinghe the acting president triggered more protests, with demonstrators storming parliament and the premier's office demanding that he quit too.
"We want Ranil to go home," Malik Perera, a 29-year-old rickshaw driver who took part in the parliament protests, said earlier on Thursday. "They have sold the country, we want a good person to take over, until then we won't stop."
IMF talks interrupted
Protests against the economic crisis have simmered for months and came to a head last weekend when hundreds of thousands of people took over government buildings in Colombo, blaming the Rajapaksa family and allies for runaway inflation, shortages of basic goods, and corruption.
Sri Lanka had begun preliminary discussions with the International Monetary Fund about a potential bailout loan, but these have been interrupted by the latest government chaos.
IMF spokesman Gerry Rice told reporters on Thursday that Fund staff were still in contact with technical-level government officials but hoped to resume high-level dialogue "as soon as possible."
Inside the president's residence early on Thursday, ordinary Sri Lankans wandered the halls, taking in the building's extensive art collection, luxury cars and swimming pool.
"The fight is not over," said Terance Rodrigo, a 26-year-old student who said he had been inside the compound since it was taken over by protesters on Saturday.
"We have to make society better than this. The government is not solving people's problems."
Protest organisers handed back the president and prime minister's residences to the government on Thursday evening.
"With the president out of the country..., holding the captured places holds no symbolic value anymore," Chameera Dedduwage, one of the organisers, told Reuters.
Another organiser, Kalum Amaratunga, said a crackdown could be imminent after Wickremesinghe branded some protesters "fascists" in an address the previous evening.
The government imposed a curfew in Colombo from noon (0630 GMT) on Thursday to early morning on Friday in a bid to prevent further unrest. Local media showed armoured vehicles with soldiers atop patrolling the city's streets.
The military said troops were empowered to use force to protect people and public property.
One dead, 84 hurt in clashes
Police said one person was killed and 84 injured in clashes between riot police and protesters on Wednesday near the parliament and prime minister's office, as people demanded the ouster of both Rajapaksa and Wickremesinghe.
The army said two soldiers were seriously injured when they were attacked by protesters near parliament on Wednesday evening and that their weapons and magazines were snatched.
Police said the man who died was a 26-year-old protester who succumbed after he was injured near the premier's office.
Former prime minister Mahinda Rajapaksa and former finance minister Basil Rajapaksa, both brothers of the president, informed the Supreme Court through their lawyer that they would remain in the country until at least Friday.
They were responding to a petition filed by anti-corruption body Transparency International seeking action "against persons responsible for the current economic crisis".
Immigration officials had stopped Basil Rajapaksa from flying out of the country on Tuesday.
Parliament is expected to name a new full-time president on July 20 and a top ruling party source told Reuters that Wickremesinghe was the party's first choice, although no decision had been taken. The opposition's choice is their main leader, Sajith Premadasa, the son of a former president.