Nepali President Bidya Devi Bhandari has appointed moderate communist KP Sharma Oli as the next prime minister of the Himalayan state.

Oli, leader of the Communist Party of Nepal (Unified Marxist-Leninist) led an alliance with former Maoist rebels to victory in Nepal's December elections. Previous PM Sher Bahadur Deuba resigned after the poor electoral performance of his Nepal Congress Party.

The 65-year-old prime minister will need to tread carefully. In recent years, Nepal's neighbours - India and China - have poured investment into the small, but strategically important, nation, that sits astride the Himalayan mountains between the two giants.

A country of 28 million people, Nepal is an attractive market for Indian and Chinese goods. Furthermore, the International Hydropower Association estimates the country's commercially viable hydroelectric potential to be 43,000MW, of which only 753MW has so far been harnessed. Nepal offers a source of clean and affordable energy, a pressing concern for both India and China.

"Oli is going to be pragmatic as prime minister to balance India and China," Kunda Dixit, editor of the weekly Nepali Times, told Reuters, though Oli's left-wing alliance is generally seen to lean towards China over India.

Nepal PM KP Oli Sharma address parliament
KP Sharma Oli led a leftist alliance to victory in the December 2017 elections PRAKASH MATHEMA/AFP/Getty Images

Nepali democracy has struggled to achieve stability since parliamentary representation was introduced in 1990. Just five years later, a Maoist insurgency took root in the nation's countryside, sparking a 10-year civil war claiming the lives of 13,000 people.

Oli spent 14 years in prison for his part in the Maoist insurgency which ended with a 2006 truce. The insurgents agreed to a ceasefire after pro-democracy protests swept through the country. The demonstrations forced the king to reinstate parliament, having disbanded it in 2002 in an attempt to crush the rebels. The Nepali monarchy was abolished in 2008 and the country was declared a federal democratic republic.

A series of short-lived coalitions have eroded confidence and growth in Nepal, and December's elections were the first to be held since the end of the civil war.

The country is also struggling to recover from the 2015 earthquake that killed 9,000 people and caused around $10bn (£7.11bn) in damage, which amounts to approximately 50% of Nepal's nominal GDP.

Woman votes in Nepal elections 2017
A Nepali voter casts her ballot at a polling station in Bhaktapur on the outskirts of Kathmandu PRAKASH MATHEMA/AFP/Getty Images

Oli previously served as prime minister from 2015-16, soon after Nepal's constitution was formalised. He is the 26th prime minister since the establishment of Nepal's parliamentary democracy in 1990.

"He has already received the appointment letter from the president," Bhandari's spokesman, Kul Prasad Chudal, told Reuters. Oli will take the oath of office on 15 February, Chudal said.

Oli has previously said he will promote peace, stability and development.

Head of the Maoist party, Pushpa Kamal Dahal - also known as Prachanda - will take over from Oli as prime minister before his five-year term ends, under an agreed power-sharing deal.

Nepali Maoists in Kathmandu
Supporters of the Unified Communist Party of Nepal (Maoist) chant slogans during a march in 2012 PRAKASH MATHEMA/AFP/Getty Images