Sri Lanka’s opposition political parties are meeting to agree on a new government a day after the country’s president and prime minister offered to resign in the wake of months of political turmoil.

Protesters who stormed the president’s official residence, his office and the prime minister’s official residence on Saturday spent the night there, saying they will stay until the leaders officially resign.

Opposition politician MA Sumanthiran said all opposition parties combined could easily muster the 113 members needed for a parliamentary majority, whereupon they will request President Gotabaya Rajapaksa installs the new government and then resigns.

He said the parties hope to reach consensus on Sunday.

Prime Minister Ranil Wickremesinghe said on Saturday that he will leave office once a new government is in place, and hours later the speaker of parliament said Mr Rajapaksa will step down on Wednesday.

Pressure on both men has grown as the economic meltdown set off acute shortages of essential items, leaving people struggling to obtain food, fuel and other necessities.

Sri Lanka
Protesters sing and dance inside the president’s official residence (Eranga Jayawardena/AP)

If both president and prime minister resign, speaker Mahinda Yapa Abeywardena will take over as temporary president, according to the constitution.

Thousands of protesters entered the capital Colombo on Saturday and swarmed into Mr Rajapaksa’s fortified residence. Video and pictures showed jubilant crowds splashing in the garden pool, lying on beds and using their phone cameras to capture the moment.

Some made tea or used the gym while others issued statements from a conference room demanding that the president and prime minister go.

Protesters rest on sofas at the prime minister’s official residence
Demonstrators rest on sofas at the prime minister’s official residence (Eranga Jayawardena/AP)

It was not clear if Mr Rajapaksa was there at the time, and government spokesman Mohan Samaranayake said he had no information about the president’s movements.

Even though both Mr Wickremesinghe and Mr Abeywardena said in their speeches that they had spoken with the president, they did not say anything about his whereabouts.

Protesters later broke into the prime minister’s private residence and set it on fire, Mr Wickremesinghe’s office said. It was not clear if he was there at the time.

Protesters swim at a pool in the president’s official residence
Protesters swim in a pool at the president’s official complex (Eranga Jayawardena/AP)

The country is relying on aid from India and other nations as leaders try to negotiate a bailout with the International Monetary Fund (IMF).

Mr Wickremesinghe said recently that negotiations with the IMF were complex because Sri Lanka is now a bankrupt state.

Sri Lanka announced in April that it was suspending repayment of foreign loans due to a foreign currency shortage.

Months of demonstrations have all but dismantled the Rajapaksa political dynasty, which has ruled Sri Lanka for most of the past two decades but is accused by protesters of mismanagement and corruption.

The president’s older brother resigned as prime minister in May after violent protests saw him seek safety at a naval base.