* New prime minister elected with help from communists
* Pledges to seek consensus and unity for new constitution
* Nepal plagued for years by instability (Adds leader's link with plane hijacking )
By Gopal Sharma
KATHMANDU, Feb 10 (Reuters) - Nepal's parliament picked a social democrat as its new prime minister on Monday after a last-minute power-sharing deal ended a deadlock that had lasted since an election two months ago.
Sushil Koirala, the head of the centrist Nepali Congress party, was elected with support from the communist UML party, which holds the second largest number of seats in parliament.
Koirala, who was onced jailed for his involvement in a plane hijacking and belongs to a noted political family, faces the task of drafting a new constitution for the Himalayan country.
Nepal, wedged between India and China, has been plagued by conflict, instability and intractable political division for years. It has been running under an interim constitution since the 2008 abolition of a centuries-old monarchy.
Both of its giant neighbours are trying to woo the desperately poor country as a geo-political ally and fear prolonged turmoil could turn it into a haven for international criminal gangs, militants and traffickers.
Koirala, 76, is the fourth member of his family to be become prime minister. He needed to be elected by a majority in parliament and his Nepali Congress party controls 194 seats in the 601-seat assembly. He won the support of 405 lawmakers.
The UML is made up of communists with more liberal political views than the Maoist former rebels who waged a civil war until 2006. UML leaders, reluctant to support Koirala, compromised after he agreed to a presidential election next year.
Koirala replaces Khil Raj Regmi, the Supreme Court chief justice who has headed a caretaker government since March last year. He now has the job of overseeing the preparation of a new constitution, one of the conditions of a 2006 peace deal that ended the decade-long war.
The charter has remained elusive because of differences about the political course the nascent republic should adopt. A previous attempt to write it failed after the term of a constituent assembly expired in 2012.
The soft-spoken Koirala is always seen wearing a black Nepali cap and sports a silver beard. He lacks experience in public administration and never held a government position when his party was in power for most of the past 23 years.
But he is known as a clean politician and was jailed in Nepal and India during the country's fight for democracy from the 1950s.
Koirala spent three years in Indian jails for his role in the hijacking of a Royal Nepal Airlines plane to the eastern Indian state of Bihar in 1973.
The plane was carrying thousands of dollars worth of cash from Biratnagar in east Nepal to the capital Kathmandu. Koirala was among the five people who were waiting for the money.
"The money was meant to support the fight for democracy launched by his party against the absolute monarchy," said Dinesh Bhattarai, a retired Nepali ambassador to the United Nations now living in Kathmandu.
On Monday, Koirala was elected despite failing to win the support of all political parties.
"The new constitution is possible only with the consensus and unity among all political parties. My government will strive for that," Koirala told the parliament.
The Maoist former rebels, who dominated governments since joining the mainstream, suffered a stunning defeat in the polls.
They were offered a berth in the new cabinet but refused to participate, Koirala's aides said.
The Maoists fear that the two big parties could gang up against them to water down their vision of a federal and secular republic. Analysts say Koirala's challenge is to win their confidence in making the charter.
Shifting political winds have increased the economic woes of Nepal's 27 million people, one quarter of whom live on a daily income of less than $2. The crisis has stunted efforts to create jobs, forcing thousands of young people to seek work abroad. (Reporting by Gopal Sharma; Editing by Angus MacSwan and Robert Birsel)