Armenia's Prime Minister Serzh Sarkisian resigned on Monday after mass protests against his election, seen as a blatant power grab by the opposition.
"I am leaving the post of the country's leader," Sarkisian was quoted as saying in a statement by his press service, just days after he took office.
"Nikol Pashinyan was right," he said referring to the leader of the protests. "I was wrong."
After serving for a decade as president, Sarkisian was last week elected prime minister by lawmakers in a move the opposition said was designed to extend his rule under a new parliamentary system of government.
Constitutional amendments approved in 2015 transferred power from the presidency to the premiership.
Sarkisian, a shrewd former military officer, was first elected president of the impoverished, Moscow-allied country in 2008.
After the 2008 vote, 10 people died in clashes between police and supporters of the defeated opposition candidate.
He was re-elected in 2013, with his second and final term ending April 9.
Earlier Monday, protest leader Pashinyan was freed after police detained him Sunday following failed talks with Sarkisian.
"So has everyone now understood that we have won?" Pashinyan told supporters shortly after his release in the capital Yerevan and before Sarkisian resigned.
Flag-waving supporters cheered the 42-year-old opposition MP and some kissed and hugged him.
An AFP reporter saw people opening a champagne bottle and handing Pashinyan a glass on the 11th day of demonstrations in the country of 2.9 million people.
Prosecutors had said that Pashinyan and two other opposition politicians "were detained as they were committing socially dangerous acts".
Protesters had denounced Sarkisian and called on the 63-year-old to stand down.
Sarkisian had earlier refused to go and on Sunday stormed out of televised talks with Pashinyan, accusing him of "blackmail".
Earlier Monday, groups of young men briefly blocked roads in Yerevan and hundreds of students marched arm-in-arm holding Armenian flags.
A group of serving soldiers joined the protests while the country's defence ministry threatened to take "serious measures" against them.
"We condemn the participation of a group of servicemen from the peacekeeping brigade of the Armenian armed forces who, violating the law, took part in an organised rally," the defence ministry said.
A number of uniformed former soldiers and veterans who fought in Nagorny Karabakh -- a breakaway region seized by Armenian separatists at the end of the Soviet era -- also marched with the protesters.
Tens of thousands had rallied in Yerevan over the weekend against pro-Kremlin Sarkisian.
In Moscow, President Vladimir Putin's spokesman said Russia was carefully watching events in Armenia, which has retained close ties to its former Soviet master.
"We are very attentively observing what is happening in Armenia," Putin's spokesman Dmitry Peskov told journalists, calling the South Caucasus country "extremely important" for Russia.
Peskov dismissed a question on whether Russia would interfere in the crisis, which he called "exclusively an internal affair", as "absolutely inappropriate."
Armenian Defence Minister Vigen Sarkisian (no relation to Serzh Sarkisian) warned that his country's foe Azerbaijan was gaining from the unrest.
"The enemy is looking at events in our country. Instability inside our country opens a road for them to take action. We need to tell society about this," the minister told reporters.
He added the army could only become involved in the crisis if a state of emergency was declared, which he hopes will not happen "for years to come".
"I think we have not crossed any red lines yet and dialogue can continue," he said. "Dialogue is better than any tension. I am opposed to Armenians coming out against Armenians."
Pashinyan, the leader of the Civil Contract Party, last week called for the "start of a peaceful velvet revolution."
Hundreds of people were detained at protest rallies across Yerevan on Sunday.
Earlier Monday, Armenia's Investigative Committee said 26 had been detained on suspicion of "hooliganism" and use of violence against police.