Armed men locked in a prolonged standoff with police in the Armenian capital, Yerevan, have taken four medics hostage, according to officials.

The gunmen seized the police post on July 17, demanding freedom for a jailed opposition figure, and took those inside hostage. The last of those held were released on Saturday.

Armenia standoff: Last four police hostages released

On Wednesday, police said an ambulance crew was held after entering the compound to treat two gunmen wounded in clashes that also left two attackers and a police officer hospitalised.

"The doctors who went into the captured territory to assist two members of the armed group who refused to go to hospital have been taken hostage," police spokesman Ashot Aharonyan wrote on Facebook.

"The police are taking steps to free the doctors through negotiations."

Gunmen demands

The hostage-takers' main demand is the release of Jirair Sefilian, an opposition leader accused by Armenian authorities of plotting civil unrest and the resignation of President Serzh Sarkisian.

Sefilian, the leader of a small opposition group named the New Armenia Public Salvation Front, and six of his supporters were arrested in June and accused of preparing to seize government buildings and telecoms facilities in Yerevan.

A critic of the government, he was previously arrested in 2006 over calls for "a violent overthrow of the government" and jailed for 18 months. He was released in 2008.

READ MORE: Armenia protesters, police clash over hostage crisis

The lengthy standoff has sparked clashes between police and protesters furious over the handling of the incident.

Demonstrators reportedly attacked police deployed outside the police station.

Many protesters were beaten and held without food and water for hours after being taken to police regiments not designed as detention centres, human rights activist Zara Hovhannisyan told Al Jazeera last week.