Colombo: Sri Lanka’s newly elected President Gotabaya Rajapaksa on Thursday sworn in as prime minister his brother and the former president, Mahinda Rajapaksa, capping a victorious return to power of the brothers credited with a military victory over Tamil rebels but also implicated in human rights violations.

Ranil Wickremesinghe stepped down as prime minister earlier on Thursday to clear the way for the president to form his government. Wickremesinghe said in a statement that he was quitting despite having a parliamentary majority, respecting the mandate Gotabaya Rajapaksa received in last Saturday’s presidential election.

A refusal to resign could have resulted in a stalemate because the president can’t sack the prime minister or appoint ministers without his advice.

Rajapaksa is widely applauded with ending a 26-year separatist civil war with ethnic Tamil rebels during his presidency from 2005 to 2015. His brother the current president then served as a powerful secretary to the Ministry of Defence.

In a boost to his grip on power, a court Thursday discharged President Rajapaksa in a corruption case, citing constitutional provisions for presidential immunity. The decision was made on the advice of the attorney general, said spokeswoman Nishara Jayaratne.

Gotabaya Rajapaksa had been charged with misappropriating $191,000 in state funds to build a monument for his parents.

He was also implicated in several investigations including the abduction and killing of critical journalists during the civil war. Jayaratne said that according to the constitution, no legal case, civil or criminal, can be filed against the president.

A US court last month dismissed a case filed by the daughter of a leading journalist killed in 2009 that Gotabaya Rajapaksa was behind her father’s death. The court said Gotabaya Rajapaksa was entitled to common law foreign official immunity.

The Rajapaksa brothers are accused of serious human rights violations during the war and Gotabaya Rajapaksa promised during the campaign that he will not honour a United Nations Human Rights Council resolution in which Sri Lanka agreed to investigate allegations against the government and Tamil Tiger rebels.