NEW DELHI (AP) — As Sri Lanka’s crisis reached its climax this weekend, two men in the center of the turmoil brought about by the country’s economic collapse promised they would heed the call of tens of thousands of angry protesters and resign.

One is President Gotabaya Rajapaksa, the last of six members of the country’s most influential family who was still clinging to power.

The other is Rajapaksa’s chosen prime minister, Ranil Wickremesinghe, a seasoned opposition politician who was brought in to steer the country out of the abyss.

On Saturday, massive crowds descended on the capital, Colombo, broke into Rajapaksa’s official residence and occupied his seaside office. Hours later, as leaders of political parties in Parliament called for both leaders to step down, protesters also stormed Wickremesinghe’s residence and set it on fire.

The culmination of monthslong protests on Saturday led to both of them agreeing to step down. Rajapaksa, whose whereabouts are unknown, said he would leave office on Wednesday, according to the parliamentary speaker. Wickremesinghe said he would depart as soon as opposition parties agree on a unity government.

Here is a closer look at their rise and fall:

GOTABAYA RAJAPAKSA

For decades, the powerful land-owning Rajapaksa family had dominated local politics in their rural southern district before Mahinda Rajapaksa was elected president in 2005. Appealing to the nationalist sentiment of the island’s Buddhist-Sinhalese majority, he led Sri Lanka into a triumphant victory over ethnic Tamil rebels in 2009, ending a 26-year brutal civil war that had divided the country. His younger brother, Gotabaya, was a powerful official and military strategist in the Ministry of Defense.

Mahinda remained in office until 2015, when he lost to the opposition led by his former aide. But the family made a comeback in 2019, when Gotabaya won the presidential election on a promise to restore security in the wake of the Easter Sunday terrorist suicide bombings that killed 290 people.

He vowed to bring back the muscular nationalism that had made his family popular with the Buddhist majority, and to lead the country out of an economic slump with a message of stability and development.

Instead, he made a series of fatal mistakes that ushered in an unprecedented crisis.

As tourism plunged in the wake of the bombings and foreign loans on controversial development projects — including a port and an airport in the president’s home region — needed to be repaid, Rajapaksa disobeyed economic advisers and pushed through with the largest tax cuts in the country’s history. It was meant to spur spending, but critics warned it would slash the government’s finances. Pandemic lockdowns and an ill-advised ban on chemical fertilizers further hurt the fragile economy.

The country soon ran out of money and couldn’t repay its huge debts. Shortages of food, cooking gas, fuel and medicine stoked public anger at what many saw as mismanagement, corruption and nepotism.

The family’s unravelling began in April, when growing protests forced three Rajapaksa relatives, including the finance minister, to quit their Cabinet posts and another to leave his ministerial job. In May, government supporters attacked protesters in a wave of violence that left nine dead. The anger of the protesters turned to Mahinda Rajapaksa, who was pressured to resign as prime minister and took refuge on a heavily fortified naval base.

But Gotabaya refused to go, triggering chants in the streets of “Gota Go Home!” Instead, he saw his savior in Ranil Wickremesinghe.

RANIL WICKREMESINGHE

A six-time prime minister, Wickremesinghe’s latest stint was arguably the most challenging. Appointed in May by Rajapaksa, he was brought in to help restore international credibility as his government negotiated a bailout package with the International Monetary Fund.

Wickremesinghe, who also was the finance minister, became the public face of the crisis, delivering weekly addresses in Parliament as he kicked off difficult negotiations with financial institutions, lenders and allies to fill the coffers and give some relief to impatient citizens.

He raised taxes and pledged to overhaul a government that had increasingly concentrated power under the presidency, a model many say tipped the country into crisis.

In his new job, he left little doubt about the grave future ahead. “The next couple of months will be the most difficult ones of our lives,” he told Sri Lankans in early June, a few weeks before he said in Parliament that the country had hit rock bottom. “Our economy has completely collapsed,” he said.

Ultimately, observers say, he lacked both political heft and public support to get the job done. He was a one-man party in Parliament – the only lawmaker from his party to hold a seat after it suffered a humiliating defeat in a 2020 election.

His reputation had already been sullied by his previous stint as prime minister, when he was in a difficult power-sharing arrangement with then-President Maithripala Sirisena. A communication breakdown between them was blamed for intelligence lapses that led to the 2019 terror attack.

With no respite for people waiting in line for fuel, food and medicine, Wickremesinghe became increasingly unpopular. Many of the protesters say his appointment simply put off pressure on Rajapaksa to resign. But analysts are doubtful whether a new leader can do much more, instead fearing that the political uncertainty will only intensify the crisis.