COLOMBO, Sri Lanka, July 21

Veteran politician Ranil Wickremesinghe was sworn in as Sri Lanka's new president Thursday to take charge of a nation bitterly angry he will remain in power amid an unprecedented economic crisis.

Sri Lankans have taken to the streets for months to demand their top leaders step down to take responsibility for economic chaos that has left the nation's 22 million people struggling with shortages of essentials, including medicine, fuel and food. While the protesters have focused on the Rajapaksa political dynasty, Wickremesinghe also has drawn their ire as a perceived Rajapaksa surrogate.

The six-time prime minister had never held the top job. But he easily won the secret ballot of lawmakers Wednesday to finish the term of former President Gotabaya Rajapaksa, who fled the country after protesters stormed his residence last week and resigned.

Wickremesinghe, 73, has wide experience in diplomatic and international affairs and has been overseeing the bailout talks with the International Monetary Fund.

Lawmakers apparently considered him the safer hands to lead the nation through the crisis, despite public anger at Wickremesinghe as an example of the nation's problematic political establishment. During demonstrations last week, crowds set his personal residence on fire and occupied his office.

After Wednesday's vote, Wickremesinghe called for politicians to work together and pleaded for the country to move on. But protesters flocked to the presidential office instead, chanting, "Ranil, go home!"

Wickremesinghe took his oath of office Thursday morning before Chief Justice Jayantha Jayasuriya at a ceremony held in Parliament in the capital, Colombo. He now can choose a new prime minister.

In an example of the troubles caused by the economic crisis, a power outage hampered live coverage of the swearing-in ceremony at Parliament. An official at Parliament who spoke on condition of anonymity as he is not authorized to speak to the media said the live coverage was to be done by state-owned Independent Television Network.

Wickremesinghe said Monday the negotiations with the IMF were near a conclusion and talks on help from other countries had also progressed. He also said the government has taken steps to resolve shortages of fuel and cooking gas.

On Wednesday, IMF Managing Director Kristalina Georgieva told financial magazine Nikkei Asia that the organization hoped to complete the rescue talks "as quickly as possible."

On Monday, in his role as acting president, Wickremesinghe declared a state of emergency that gave him broad authority to act in the interest of public security and order. Authorities can carry out searches and detain people, and Wickremesinghe can also change or suspend any law. Parliament can regularly review the law and it will expire without its approval.

Presidents in Sri Lanka are normally elected by the public. The responsibility falls to Parliament only if the presidency becomes vacant before the term officially ends. It has happened once before, in 1993, when then-Prime Minister Dingiri Banda Wijetunga was chosen by Parliament uncontested after former President Ranasinghe Premadasa, father of the current opposition leader, was assassinated.