Parliamentarians in Nepal have elected a new prime minister after more than seven months of stalemate.
The deadlock was finally resolved when the Maoists, the largest single party, decided to withdraw their candidate and to support Jhalanath Khanal, the chairman of a smaller allied party.
Nepal has been without a functioning government since June.
Speaker Subash Chandra Nemwang told parliament tha tJhalanath Khanal had secured 368 of the 598 votes cast.
It was the 17th time MPs had voted to elect a new prime minister.
The BBC reports changes in the election process helped to clear the deadlock.
Previous prime minister after Madhav Kumar Nepal resigned in June in a dispute over control of the army and the integration of former fighters into regular forces.
He has been running a caretaker government ever since.
Mr Khanal, 60, is a veteran politician who was involved in pro-democracy protests against the monarchy in 1990 and again in 2006.