YEREVAN (Reuters) - Opposition leader Nikol Pashinyan was elected Armenia’s prime minister on Tuesday, capping a peaceful revolution driven by weeks of mass protests against corruption and cronyism in the ex-Soviet republic.

Moscow, which has a military base in Armenia, is wary of an uncontrolled change of power which would pull the country out of its orbit, but Pashinyan has offered assurances that he will not break with the Kremlin.

Russian President Vladimir Putin congratulated Pashinyan on his election.

The election of Pashinyan, a former newspaper editor who spent time in prison for fomenting unrest, marks a dramatic rupture with the cadre of rulers who have run Armenia since the late 1990s.

Minutes after parliament voted to make him prime minister, Pashinyan traveled to a square in the capital, Yerevan, where tens of thousands of cheering supporters, many wearing T-shirts bearing his portrait, waited to greet him.

“The people won,” Pashinyan told the crowd. “Congratulations.”

Throughout the protests, Pashinyan had dressed in a camouflage T-shirt and military-style cap, an outfit that became his trademark, but on Tuesday he changed into a suit and tie.

Pashinyan, born in 1975, spearheaded a protest movement that first forced veteran leader Serzh Sarksyan to step down as prime minister and then pressured the ruling party to abandon attempts to block his election as prime minister, the country’s most powerful post.

In a vote in parliament on Tuesday, 59 lawmakers backed Pashinyan’s candidacy, including some from the ruling Republican Party, with 42 voting against.

In Yerevan’s Republic Square, Pashinyan’s supporters watched the voting on huge television screens. When the result was shown, there were chants of “Nikol!”, white doves were released into the air and people hugged and kissed each other.

“We won! We made history today!” said Gurgen Simonyan, 22, a student in the crowd.

Pashinyan’s protest movement was sparked when Sarksyan, barred by the constitution from seeking another term as president, became prime minister instead. Many Armenians saw that as a cynical ploy by Sarskyan to extend his hold on power.

NEW SCRIPT

Armenia is a country of about three million people nestled in mountains between Iran, Turkey, Georgia and Azerbaijan.

Since it emerged as an independent state after the collapse of the Soviet Union, Armenia, a majority Christian country, has been locked in a territorial conflict with mainly-Muslim Azerbaijan, and under economic blockade from Turkey.

Its isolation led it to depend heavily on former colonial ruler Moscow. Putin has in the past resisted popular revolts in ex-Soviet states, particular in Georgia and Ukraine, viewing them as a ploy by Washington to encroach on Moscow’s sphere of influence.

But throughout Armenia’s wave of protests, Moscow has remained publicly neutral, and Pashinyan has consistently said he viewed Moscow as a vital ally.

Slideshow ( 3 images )

He said on Tuesday Armenia would stay in a regional collective security organization headed by Russia and that he hoped for a meeting with Putin.

The Kremlin said Putin sent Pashinyan a congratulatory telegram. “I hope your activities as head of the government will help further strengthen the ties of friendship and alliance between our countries,” Putin said in the message.

Thomas de Waal, a specialist on the region with Carnegie Europe, a think tank, said with the Armenian uprising, both Yerevan and Moscow had learned a new script.

“Russian officials have insisted that they respect Armenians’ right to peaceful change,” he said. “For his part, Pashinyan and his fellow protest leaders told their supporters to avoid anti-Russian or pro-EU slogans.”

Slideshow ( 3 images )

HOLDOVERS

Pashinyan faces tough challenges. The civil service and security apparatus are dominated by allies of his ousted predecessor.

He has said his first step will be to hold an early parliamentary election. In the meantime, he said he would carry out root-and-branch reforms to cut out graft and cronyism.

He said he would fire some holdovers from the ruling elite, among them the defense minister, but said there would be no “pogrom.”

He must also reckon with a parliament where the Republican Party, allied to Sarskyan, holds a majority of seats and is skeptical about his revolution.

Vahram Baghdasaryan, head of the Republican Party in parliament, said for the sake of unity it was backing Pashinyan for prime minister but it had concerns about his fitness to run the country.

“I hope we are mistaken,” said Baghdasaryan, an ally of Sarskyan.

In his speech before the vote, Pashinyan called on Armenia’s people to come together behind the new government he will lead. “The page of hatred should be turned,” he said, adding: “May God help us.”