All armed hostage-takers have surrendered after two weeks of standoff in Armenia's capital Yerevan as they barricaded themselves inside a police compound.
One more gunman was wounded by security forces on Sunday, who had given the attackers until 5pm local time on Saturday to surrender.
"The security forces' anti-terrorist operation has ended and led to the members of the armed group laying down their weapons and surrendering to the authorities," the national security services said in a statement.
"Twenty terrorists were arrested."
The gunmen had held four police officers hostage for a week before releasing them unharmed. They later seized four members of an ambulance crew, but the last two were allowed to leave on Saturday.
The gunmen killed one officer and wounded several others in their initial attack.
Police accused the opposition gunmen of killing a second officer on Saturday as he sat in a vehicle away from the compound, but this was denied on Sunday by a leading member of the armed group inside.
WATCH: Can tension in Armenia be contained?
The standoff started on July 17 when 31 gunmen seized the police compound demanding freedom for the leader of the opposition group who was arrested in June.
The opposition group has sharply criticised the government of the former Soviet republic and called for people to take to the streets to force the president and the prime minister to step down.
Several thousand people have joined nightly rallies to support the gunmen, occasionally clashing with police.
On Saturday night, the demonstrators marched down Baghramyan Avenue toward the main government buildings and the presidential residence, but were stopped by riot police, who strung coils of barbed wire across the road.
The demonstrators blocked traffic for about two hours, but dispersed peacefully early on Sunday.
Al Jazeera's Robin Forestier-Walker, reporting from Yerevan, said the protesters vowed to continue their struggle after it was announced by the security services that the armed men had been arrested.
"The security services refer to them as terrorists .., but for many of the young people gathered at the protest, they are freedom fighters and heroes," he said.
The gunmen themselves said that they would continue their struggle as "political prisoners", he said.
"They said that they have taken the desperate measures to take over the police station to raise awareness, to kickstart an awakening in Armenia and get rid of the Sargsyan government," he said.
"President Serzh Sargsyan has become increasingly unpopular here due to all sorts of problems with the country's economy, widespread corruption and a war with Azerbaijan earlier this year in which Armenia lost territory in the disputed Nagorno-Karabakh region."
Source: Al Jazeera and agencies