(Bloomberg) -- Malaysian stocks surged the most in over two years after veteran opposition leader Anwar Ibrahim was appointed the new prime minister, ending a political impasse that’s weighed on markets this week.

The benchmark FTSE Bursa Malaysia KLCI Index rallied 4% at the close. Gaming and brewery companies including Genting Malaysia Bhd., Sports Toto Bhd., Magnum Bhd., and Carlsberg Brewery Malaysia Bhd. rose as the pro-Malay, Islamist alliance Perikatan Nasional lost out on its bid to form the government.

While a coalition government led by Anwar’s reformist Pakatan Harapan would need to strike compromises to achieve his campaign pledges, it lays to rest investors concerns over Perikatan Nasional’s desire to turn Malaysia into an Islamic state. Anwar has said he wants to tackle the cost of living, while bolstering the nation’s smaller-sized firms.

“It is certainly a relief to get clarity and some certainty on the leadership, especially from someone with the charisma and proclivity to bridge differences to build a government,” said Vishnu Varathan, head of economics and strategy at Mizuho Bank Ltd. in Singapore. “The hope is that this is indeed a lasting resolution of disruptive political shifts rather than an unstable equilibrium.”

Malaysian assets had traded in a narrow range this week after Saturday’s vote resulted in the first-ever hung parliament. The ringgit traded 1.9% higher versus the dollar at 4.4897 on Thursday, set for its best showing since 2015 and the top performer in Asia.

To be sure, the nation’s economy is still on a fragile rebound, with rising living costs stirring discontent. But analysts had said that investor sentiment toward the Southeast Asian nation could dramatically change once a new coalition became clear due to more positive policy support. 

Thursday’s rebound is driven largely by the removal of political impasse, said Danny Wong, chief executive officer of Areca Capital. “We are sanguine that more measures will be announced soon” under the new Budget. 

Anwar’s reformist Harapan will lead the next government after being chosen by King Sultan Abdullah Sultan Ahmad Shah, the country’s monarch said in a statement. The king intervened after no alliance secured a majority in a general election in which Anwar’s coalition won the most seats.

“His Majesty reminds all quarters that whoever wins, doesn’t win all, and those who lose do not lose all,” the palace said. “The people should not be burdened by endless political turmoil as the country needs a stable government that will boost the economic landscape and national development.”

--With assistance from Ronojoy Mazumdar, Catherine Ngai and Marcus Wong.

(Updates throughout)

©2022 Bloomberg L.P.