Both Kurdish and Syrian government forces agreed to a ceasefire after a three-day eruption of heavy fighting left more than 26 civilians dead.

According to the truce document, Kurdish forces can keep the territory they captured in Qamishli during those days of violence. Both sides will release prisoners taken during the clashes.

The fighting which erupted last week between Kurdish and Syrian forces was reportedly the biggest since the Syrian uprisings and subsequent civil war began in 2011. During the clashes, Kurdish security forces seized control of a number of key government controlled positions in Qamishli, including its main prison.

Canaan Barakat, Syria's Kurdish regional interior minister, announced the terms of the truce on Sunday, and said that 17 civilians and 10 Kurdish military personnel were killed last week.

The Syrian Observatory for Human Rights (SOHR) reported that 22 members of Syrian government forces died and 80 were taken prisoner. SOHR also reported that 23 civilians died during government shelling of Kurdish-controlled areas.

A copy of the truce agreement seen by the Syrian Observatory for Human Rights said "each side will keep the territory under its control." Kurdish authorities and media said this meant territory taken from government control would not be returned.

The agreement said that employees of the Syrian state must not be threatened, deprived of their salaries or recruited into joining "local protection units that belong to the regime".

Damascus maintains a strong administrative presence and still pays government employee salaries in Qamishli, one of the largest cities in Hasaka province in Syria's far northeast corner adjoining Turkey and Iraq.

The agreement said the structure of pro-government forces stationed in Qamishli would be reviewed and Damascus would no longer interfere in local society, but provided no further information elaborating on these measures.

Compensation would be paid to civilians who lost relatives or suffered material damage in government shelling, it added.

Qamishli sits near Syria's border with Turkey and at the base of Turkey's Taurus Mountains, a great chain that extends cuts through southern Turkey. It is mostly controlled by Kurdish security forces. Pro-Assad government forces still maintain control over a few areas in the city's center, including its airport.

But Syrian Kurdish forces dominate wide areas of northern Syria, and have set up their own government there. Syria has become a patchwork of areas controlled by the government, an array of rebel groups, Islamic State militants, and Kurdish militia.

Meanwhile, mediators are struggling to keep a nationwide truce in effect. All warring factions are mired in distrust, and suspect one another of breaking the cessation of hostilities deal, which was brokered on February 27.

On Friday, Staffan de Mistura, the UN special envoy for Syria, estimated that about 400,000 people had been killed over the last five years of civil war. Mistura urged key players in the war to help salvage the crumbling ceasefire agreement. Mistura added that the death toll was his own estimate, not an official UN statistic.

The envoy said he would continue to hold peace talks next week, regardless of "the worrisome trends on the ground."