Nikol Pashinyan / REUTERS

Armenia's parliament elected protest leader Nikol Pashinyan as prime minister on Tuesday after weeks of protests forced his predecessor out.

Fifty-nine lawmakers in the 105-seat legislature voted for Pashinyan, giving him the majority needed for the post, Reuters said.

Last week a majority of lawmakers rejected his candidacy.

Read alsoArmenian Revolution: Russian influence to remain amid power shift

Pashinyan, a former journalist and leader of the opposition Civil Contract party, put himself at the front of the protest movement as thousands of people took to the streets in Yerevan after veteran leader Serzh Sargsyan, who had served the maximum two terms as president of Armenia, was appointed prime minister two weeks ago.

Stung by the protests, Sargsyan stepped down.

Supporters say Pashinyan, a former newspaper editor who was also imprisoned after opposition rallies in 2008 turned deadly, is among history's great peaceful revolutionaries, The Guardian said. "You can absolutely compare him with historical figures like Gandhi and Nelson Mandela," said Eduard Aghajanyan, a city council member from Pashinyan's Civil Contract party, and one of Pashinyan's young, western-educated advisers.

It has been a dangerous road for Pashinyan. He was expelled from university in 1995 for his political activities, and faced libel charges as the editor-in-chief of Haykakan Zhamanak in 2000. His car was blown up in an apparent assassination attempt in 2004, and in 2008 he spent months in hiding after being accused of instigating political protests that ended with 10 people dead. He was sentenced to seven years in prison in 2010 but was released the following year under an amnesty.

He has publicly fallen out with other opposition leaders such as the former president Levon Ter-Petrosyan. In private, detractors say Pashinyan is a novice when it comes to working in government and unwilling to compromise. He entered parliament in 2016 as a member of a coalition of opposition parties.

"The main question is whether Nikol Pashinyan the revolutionary can become Nikol Pashinyan the prime minister," said Emil Danielyan, a journalist and political analyst in Yerevan.