By Hasmik Mkrtchyan

YEREVAN (Reuters) - Armed men who seized a police station in the Armenian capital Yerevan surrendered to the authorities on Sunday after a two-week stand-off, the country's National Security Service said.

"The anti-terrorist operation is over," the service said in a statement, adding that the authorities had "forced the members of the armed group to lay down their arms".

"Twenty terrorists have been taken prisoner," the police said.

A group of around 30 gunmen had originally seized the police station on July 17, killing a police officer, wounding two others and taking nine people hostage.

A second policeman, outside the building, was killed on Saturday, when the police had given the men an ultimatum to surrender.

Several gunmen were also wounded during the 14 days of the stand-off.

In a sign of the deep divisions within Armenian society, the gunmen had attracted sympathy from several thousand opposition protestors, leading to street clashes with police.

The armed men included veterans of the war in Nagorno-Karabakh with neighboring Azerbaijan, and were seen as national heroes by their supporters, who want the government to pursue a harder line on the issue.

Within a week, the group had released all its hostages, including two senior police officers, but they then took four doctors hostage and refused to surrender. The doctors were also eventually released.

The hostage-takers' main demand was the release of Jirair Sefilian, an opposition leader accused by the authorities of plotting civil unrest. Sefilian was jailed in June over allegations of illegally possessing weapons.

Sefilian, a former military commander, has accused Armenian President Serzh Sarksyan of mishandling the long-running conflict between Armenian-backed separatists and Azeri forces in the Nagorno-Karabakh region of Azerbaijan.

A Moscow-brokered ceasefire halted four days of violence in the South Caucasus region in April, the worst flare-up in years, but sporadic shooting persists at night and some deaths have been reported.

The gunmen were also demanding the resignation of President Sarksyan, and blamed the authorities for economic and social problems in the country of 3.7 million.

"Our task is fulfilled," Varuzhan Avetisyan one of the gunmen, told Armenian Internet TV and newspaper 1in.am shortly before surrendering to the police.

"Popular protest will continue. We feel that our victory is close and call on Armenian people to continue the fight," he said.

(Writing by Jason Bush and Margarita Antidze; Editing by Andrew Bolton)