Madhav Kumar Nepal was the candidate of an alliance of 22 parties
Nepal's parliament has elected veteran communist leader Madhav Kumar Nepal as the country's new prime minister in a bid to end weeks of political turmoil.
Mr Nepal, the leader of the Communist Party of Nepal (Unified Marxist-Leninist), was the only candidate.
The former Maoist Prime Minister, Prachanda, resigned on 4 May following a dispute with the country's president.
Earlier, a bomb blast during a service at a Roman Catholic church south of the capital, Kathmandu, killed two people.
Religious conflict is rare in Nepal and a local Christian leader, Tirtha Thapa, said he believed it was the first such attack on a church.
No group has said it carried out the attack, which injured 12 people.
Not long after the bombing, parliamentary speaker Subash Nemwang announced that Mr Nepal had been elected unopposed as prime minister after the Maoists said they would not field any candidate and would boycott the vote.
The 56-year-old was last week named the candidate of an alliance of 22 parties, which have 350 members in the 601-seat assembly.
The composition of the new cabinet has yet to be finalised, but the Nepali Congress, Madhesi Janadhikar Forum, Terai-Madhes Loktantrik Party and the Sadbhawana Party have said they will join the CPN.
The Maoists branded the formation of a new government "a farce".
Prachanda resigned as prime minister three weeks ago, after eight months in office, in protest at a decision by President Ram Baran Yadav to veto his attempt to dismiss the head of the army.
The Maoists came to power last year after declaring an end to their decade-long armed struggle and becoming the largest party in parliament in a subsequent general election.
They have promised not to disrupt the peace process begun in 2006, and have said they are committed to a civilian government.