Sri Lankan President Gotabaya Rajapaksa has announced he will step down after protesters stormed his official residence and set the prime minister's house on fire.
Neither the PM nor the president were in the buildings at the time.
Hundreds of thousands descended on the capital Colombo, calling for Mr Rajapaksa to resign after months of protests over economic mismanagement.
Mr Rajapaksa will step down on 13 July. PM Wickremesinghe has agreed to resign.
The announcement triggered an eruption of celebratory fireworks in the city.
The extraordinary events of Saturday appeared to be the culmination of months of mainly peaceful protests in Sri Lanka.
Huge crowds converged on the official residence of President Rajapaksa, chanting slogans and waving the national flag before breaking through the barricades and entering the property.
Footage online showed people roaming through the house and swimming in the president's pool, while others emptied out a chest of drawers, picked through the president's belongings and used his luxurious bathroom.