Sri Lanka's acting President Ranil Wickremesinghe on Wednesday was elected the country's new president, as the country has been grappling with its worst financial crisis.

The secretary-general of the parliament announced that Wickremesinghe, winning 134 votes in the 225-member parliament, has been elected the succeeding president.

Earlier on Wednesday morning, the parliament voted to elect a new president.

A total of 219 votes were found valid. While four votes were found invalid, two lawmakers abstained from Wednesday's voting.

Three candidates were in the race to become the next president.

Sri Lanka's acting President Ranil Wickremesinghe faced the opposition-backed Dullas Alahapperuma and Anura Kumara Dissanayake during the secret ballot vote.

Alahapperuma, who won 82 votes, is a former education minister and a dissident member of the Sri Lanka Podujana Peramuna party, which is controlled by former President Gotabaya Rajapaksa clan. Rajapaksa fled the country and resigned last week amid mass protests.

The third candidate was Anura Kumara Dissanayake of the National Peoples’ Power party, which has only three members in parliament. Dissanayake won three votes in total.

Last week, Prime Minister Ranil Wickremesinghe was sworn in as the country's interim president after Rajapaksa fled the country.

The country's parliament then started the process to elect a new president.

Rajapaksa fled to Singapore from the Maldives.

He escaped from Sri Lanka after thousands of protesters stormed the presidential palace in the capital Colombo and set fire to the prime minister’s house.

Sri Lankans blame the Rajapaksa political dynasty for the crisis. Rajapaksa’s brother Mahinda resigned as the prime minister in May.

Crippled by a shortage of foreign exchange reserves after the collapse of its tourism-dependent economy, the island nation of 22 million people has defaulted on all its foreign debt.

It has been unable to pay for food, fuel, and other essentials, with the fuel shortage in turn leading to prolonged daily power cuts. Schools have been closed and state employees asked to work from home.

The government is negotiating with the International Monetary Fund for a bailout package, but no deal has been finalized so far.s on Thursday, having left Sri Lanka in the grip of economic chaos as months of nationwide mass protests called for his ouster.