COLOMBO, Sri Lanka — President Gotabaya Rajapaksa, whose family has dominated politics in Sri Lanka for much of the past two decades, has agreed to resign after months of protests accusing him of running the island nation’s economy into the ground through corruption and mismanagement, the speaker of the country’s parliament said on Saturday.
Mahinda Yapa Abeywardena, the parliamentary speaker and an ally of the president, announced the development at the end of a chaotic day. Protesters entered the president’s residence and office, and thousands more descended on the capital, Colombo, to register their growing fury over his government’s inability to address a crippling economic crisis. As the demonstrations swelled, the country’s political leaders urged Mr. Rajapaksa to step down.
There was no direct confirmation about the potential resignation from Mr. Rajapaksa, who is in hiding and who in the past has remained defiant. Mr. Abeywardena, in a televised statement, said the president had informed him he would resign on July 13, “to ensure a peaceful transition of power.”
By the evening, Prime Minister Ranil Wickremesinghe, who took office only in May and was also facing demands to resign, said he would step down, saying he had “the safety of all citizens” in mind. Protesters also entered his private home late Saturday and set it ablaze, said Dinouk Colombage, a spokesman for the prime minister, adding that Mr. Wickremesinghe was not at home at the time.
Sri Lanka has run out of foreign-exchange reserves for imports of essential items like fuel and medicine, and the United Nations has warned that more than a quarter of Sri Lanka’s people are at risk of food shortages.
The economic crisis is a major setback for the nation, which is still grappling with the legacy of a bloody three-decade civil war. That conflict, between the government and insurgents who had taken up the cause of discrimination against the ethnic minority Tamils, ended in 2009. But many of its underlying causes have remained, with the Rajapaksa family continuing to cater to the majority Buddhist Sinhalese.
The country’s downward spiral has played out as high energy prices and food inflation have afflicted much of the world. Russia’s invasion of Ukraine, and the sanctions that followed, have sent energy prices flying, while global food supply chains are increasingly dwindling under stress and demand.
The turmoil in Sri Lanka has already begun to reshape the geopolitical landscape of the region, where the island nation of 22 million has long been viewed as a strategic prize, with both China and India — longtime rivals — jostling for influence.
On Saturday, at least 42 people were injured in clashes with security forces in the city, health officials said, after the police used tear gas and water cannons against protesters and fired shots into the air to try to disperse them.
A Sri Lankan television station said four of its journalists were attacked by security forces outside the residence of Mr. Wickremesinghe, the prime minister, on Saturday evening.
Local news media showed footage of protesters breaching parts of the presidential residence as well as his secretariat, a separate building that houses his office.
Videos on social media showed protesters jumping into the pool in Mr. Rajapaksa’s residence, resting in bedrooms, and frying snacks in the presidential kitchen.
“I came here today to send the president home,” said Wasantha Kiruwaththuduwa, 50, who had walked 10 miles to join the protest. “Now the president must resign. If he wants peace to prevail, he must step down.”
Speculation about the whereabouts of Mr. Rajapaksa continued to intensify into the evening, but his location remained unclear. Officials at the Defense Ministry and in the army did not immediately respond to questions about Mr. Rajapaksa’s location.
Karan Deep Singh contributed reporting.