Kurdish forces seized nearly full control of the Syrian town of Tal Abyad on Monday, fighting only pockets of jihadists on a vital supply line for the Islamic State group.
The Kurdish People's Protection Units (YPG) advanced into Tal Abyad after taking a border post and cutting off the road south to the de facto IS capital of Raqa, a monitoring group said.
"The Kurdish fighters are in almost full control of Tal Abyad," said Rami Abdel Rahman, director of the Syrian Observatory for Human Rights.
Abdel Rahman said there were still "some small pockets of resistance from small groups of Islamic State fighters who are still holed up inside".
At least 40 jihadists were killed as they fled Tal Abyad for Ein Issa, another town still under IS control.
It came hours after the Kurdish forces said they had completely surrounded Tal Abyad.
"There is nowhere Daesh can escape to," said YPG commander Hussein Khojer, using the Arabic acronym for IS.
The advance is a blow to IS, which had been battling to hold onto Tal Abyad and preserve its main supply line between Raqa and the Turkish border.
Kurdish fighters and Syrian rebels began their main advance on Tal Abyad on June 11, backed by air strikes from the US-led coalition fighting IS.
"Coalition air strikes are exacting a high price on Daesh terrorists across Iraq and Syria," said US Brigadier General Thomas Weidley.
"Since fall 2014, Kurdish forces in both Iraq and Syria, enabled by the coalition, have only taken territory from Daesh, never ceding it."
The clashes have prompted thousands of civilians to flee, with some 20,000 crossing into Turkey since last week, including at least 3,000 for the second consecutive day.
The flood of refugees has created chaos at times, with some cutting through the border fence or scrambling over loops of barbed wire in frustration at the delay in crossing.
Parents passed screaming children over one section of trampled fencing, and a mother grasped her baby by one arm, a pacifier dangling from its neck.
- 'Lifeblood channel' for IS -
Signup to our newsletter and follow us on Facebook and Twitter!
Tal Abyad lies some 85 kilometres (50 miles) north of Raqa, and analysts say it serves as a primary conduit for incoming weapons and fighters, as well as for outgoing black market oil.
"It has been an IS stronghold for a while now, and it has been described as the gateway to Raqa," said Charlie Winter, a researcher on jihadism at the London-based Quilliam Foundation.
"Certainly, it's of strategic importance because it's a border town through which equipment, recruits, etc. can pass."
Tal Abyad is also just 70 kilometres (40 miles) east of the Kurdish-majority town of Kobane, where Kurdish forces battled for months before expelling invading IS forces in January.
Tal Abyad serves as the "main lifeblood channel for IS," connecting Raqa city to the outside world, said Mutlu Civiroglu, a Kurdish affairs analyst.
"Tal Abyad is a financial and logistical hub for IS. Once you cut this hub it is going to be very hard for IS to smuggle in fighters, to sell oil and deal in the other goods they deal in."
Kurdish forces have been chipping away at IS territory in Raqa province -- once completely under the jihadist group's control -- for around three months.
According to the Observatory, they have seized some 50 towns and villages in the province.
Winter said he expected IS to mine the town heavily.
- Turkey fears of Kurdish rise -
The Kurdish advance has prompted criticism from Turkey, where the YPG-linked Kurdistan Workers Party (PKK) fought a decades-long insurgency and is listed as a "terrorist" group.
Nihat Ali Ozcan, an analyst at the Ankara-based TEPAV think tank, said Ankara was concerned about rising "separatist sentiment" among Kurds in Turkey's southeast.
"If Tal Abyad is seized by Kurds, after Kobane's liberation, Kurds might emerge as a fighting force against Turkey," Ozcan said.
The Kurdish advance has also prompted allegations of "ethnic cleansing" by some Syrian rebel groups who say YPG forces are expelling Sunni Arabs and Turkmen from the area.
Kurdish forces reject those allegations, saying they have only asked civilians to evacuate potential battle zones to avoid casualties.
Meanwhile, in Aleppo, at least 23 people were killed and 100 wounded, around half of them children, in rebel rocket fire on regime-held parts of the northern city, state media said, condemning it as a "massacre".