Kuala Lumpur: The biggest political threat to Malaysia’s government is behind bars after a court upheld a sodomy conviction for opposition leader Anwar Ebrahim, but more thorny problems confront Prime Minister Najeeb Razzak.

Anwar, jailed for five years on Tuesday on a charge he called politically motivated, has for years represented the greatest challenge to Najeeb’s coalition, which has ruled the multi-ethnic Southeast Asian country since independence in 1957.

The bespectacled former finance minister and deputy prime minister cemented a three-party opposition alliance which took on the coalition at the last polls in 2013, costing the ruling bloc the popular vote in its worst-ever electoral performance.

Deserted at the polls by ethnic minority Chinese and urban voters, Najeeb’s party will now face the fallout of sharper polarisation over Anwar’s jailing, amid widespread perceptions that his prosecution was motivated by political vengeance.

“There’s something rotten about the whole thing,” said former cabinet minister Zaid Ebrahim. “It’s not good for the country and democracy, never mind Najeeb.” “Even to prosecute Anwar for these kind of affairs is just unreasonable, it carries such a heavy sentence,” he added.

The government denied interference in Anwar’s case.

While Anwar’s jailing could bolster Najeeb’s standing among hardliners at home, foreign investors are likely to be alarmed at a time when Malaysia is facing sliding oil and gas revenues.

The United States was “deeply disappointed” with Anwar’s conviction, which “raised a number of serious concerns about rule of law and the fairness of the judicial system”, said US. National Security Council spokeswoman Bernadette Meehan.

But more damaging for Najeeb than foreign reproach over Anwar is likely to be criticism at home of his leadership, especially from within his own party.

“He has put the opposition challenge away for a couple more years, but his immediate problems are from internal critics and it will probably get worse,” said Ebrahim Suffian, the director of the Kuala Lumpur-based research firm Merdeka Centre.

Unfortunately for Najeeb, his biggest critic is former Prime Minister Mahathir Mohammad, who led Malaysia for 22 years until 2003 and remains influential.

“Please resign”

Najeeb is a self-described moderate who came to power with reformist plans. The more conservative Mahathir has made no bones about what he thinks of Najeeb’s premiership.

Last year, in a savagely critical blog post, Mahathir said he was withdrawing support from Najeeb. This month, Mahathir said there was “something rotten in the state of Malaysia” and/sopenly questioned Najeeb’s handling of the country.

“If you don’t perform and people say you’re no good, please resign,” Mahathir told news portals.

“As for Najeeb, I don’t know if he is performing.” Najeeb has quietly set aside his liberal agenda, dashing hopes for social reform and the scrapping of old security laws used to stifle dissent.

But it is not only Najeeb’s leadership that his critics have questioned. His personal life has come under scrutiny amid reports of his family’s lavish spending.

There is also suspicion of mismanagement at state investment firm 1MDB. Najeeb is chair of its board of advisers. Concern over 1MDB’s $11.6 billion of debt has pressured the ringgit and the country’s sovereign credit rating.

Now that Anwar is out of the picture, Najeeb’s detractors in the ruling party could set their sights on him, analysts and government insiders say.

“Anwar’s exit is quite a big risk for Najeeb,” said Wan Saiful Wan Jan from the Institute for Democracy and Economic Affairs.

“UMNO leaders will be more vocal about Najeeb’s flaws,” he said, referring to the ethnic Malay party at the heart of the ruling coalition.

A source close to the government said Anwar’s jailing was “not in the prime minister’s domestic or international interests”.

Malaysia next election must be held by 2018 and sympathy for Anwar could stoke support for the opposition.

“This is a silver lining for the party in a way ... it’s Pakatan’s opportunity to show they can function without Anwar,” said Wan Saiful, referring to the diverse Pakatan Rakyat alliance.

Anwar’s politician daughter, Nurul Izzah, said the opposition must stay united.

“We have no chance if we do not present a cohesive union,” Narul told Reuters.

“Everyone has to step up. This is not Anwar Ebrahim’s personal quest. He has been attacked for 17 years because we got together to challenge the government.”