The clashes in Syria's Idlib province in the country's northwest pit the jihadist Hayat Tahrir al-Sham (HTS) against the key rebel group Ahrar al-Sham, which is supported by Turkey and some Gulf countries.
The factions were once allies and fought alongside each other to capture most of Idlib province from the Syrian government in 2015.
But growing tensions between the two have been exacerbated, analysts say, by HTS's fears of a plan to expel the internationally designated "terror" group from the province.
The fighting erupted on Tuesday and has now killed at least 92 people, including 15 civilians, the Syrian Observatory for Human Rights monitor said.
It had engulfed much of the province, including the key Bab al-Hawa border crossing with Turkey, which had been controlled by Ahrar al-Sham.
By Friday evening, however, the groups issued identical statements announcing a truce agreement.
The deal included "a ceasefire, the release of detainees from both sides, and the exit of armed groups from the Bab al-Hawa border crossing and its transfer to a civilian administration," the statements said.
Within an hour of the announcement, an AFP correspondent in Idlib city reported the situation was calm with the sounds of clashes and explosions stopping and some civilians coming back outside.
- Strong player, weak player -
Nawar Oliver, a military analyst at the Istanbul-based Omran Centre think-tank, reacted with skepticism to the truce.
"There have been plenty of agreements on paper that have not been implemented. I don't think this is the end of (the fighting)," Oliver told AFP.
"This is a truce between a strong player and a weak player. International support for Ahrar has halted, and it doesn't look good for them."
HTS had seized several villages before the announced truce, according to the Observatory and media channels affiliated with the group.
Observatory head Rami Abdel Rahman said Bab al-Hawa had "become a battlefield, with part of it under Hayat Tahrir al-Sham's control, and part under Ahrar al-Sham's control."
Signup to our newsletter and follow us on Facebook and Twitter!
An AFP correspondent had also reported heavy clashes as HTS fighters attempted to advance in the province's east, including the sound of large explosions and heavy weaponry.
HTS is dominated by the Fateh al-Sham faction, which was previously known as Al-Nusra Front before renouncing its ties to Al-Qaeda.
The clashes were accompanied by sporadic demonstrations against HTS in several parts of the province, including in the town of Saraqeb where the jihadists on Wednesday and Thursday opened fire on protests against them.
On Wednesday, the shots killed a media activist taking part in the demonstrations in the town.
Both sides had set up new checkpoints, and parts of the province were transformed into virtual ghost towns with residents staying home for fear of being caught in the crossfire, the AFP correspondent said.
- 'Vying for control' -
Experts said the outbreak of violence comes against the backdrop of a deal agreed in the Kazakh capital Astana in May for four "de-escalation zones" in Syria.
The agreement between regime allies Russia and Iran, and rebel backer Turkey, designates the Idlib region as one of the mooted zones where combat between the government and rebels would halt.
HTS opposes the agreement, which calls for continued fighting against jihadist groups like its main component Fateh al-Sham Front.
"As soon as there was the announcement of Idlib as a de-escalation zone, that's it. HTS felt like a war is upon it," Oliver told AFP.
Sam Heller, a Syria expert at the Century Foundation, said the groups were "vying for control for Idlib province".
"Whatever kind of political or ideological differences existed between them have been exacerbated or inflamed by the Astana talks, as well as by the rumours -- if not the reality -- of some larger deal that would work against HTS," he said.
Oliver said the fighting was a chance for each side to gain valuable territory, including the border crossing where taxes and tariffs can be extracted.
Idlib is one of the last major parts of Syria beyond the control of the government, which has recaptured vast swathes of territory from opposition fighters since its ally Russia intervened on its behalf in September 2015.
More than 330,000 people have been killed in Syria since the conflict began in March 2011 with anti-government protests.