Turkish military and allied Syrian have captured the northern Syrian town of Afrin, previously controlled by the Kurdish militia known as the People’s Defence Units (YPG).

Turkey’s president Recep Tayyip Erdogan announced the town’s capture and said: “Many of the terrorists had turned tail and run away already. In Afrin’s centre, it is no longer the rags of the terror organisation that are waving but rather the symbols of peace and security.”

The victorious troops raised their flags and shot in the air in celebration nearly two months after launching their offensive on the Kurdish enclave. They faced little resistance from the Kurdish militia that retreated and vowed to turn to guerrilla tactics, calling the assault on Afrin “occupation”.

western Syria (Hasan Kırmızitaş/DHA-Depo Photos via AP)A Turkish and a Turkey-backed Free Syrian Army soldier wave Turkish and FSA flags in Afrin, north-western Syria (Hasan Kırmızitaş/DHA-Depo Photos via AP)

Kurdish officials said they had evacuated Afrin of civilians. Footage of long lines of vehicles leaving the town was aired on Syrian state-run TV. Fewer residents got out on foot or on motorcycles heading to government-controlled areas nearby.

Limited fighting was reported later in some pockets in Afrin while Turkish military said it was combing the area for land mines and explosives.

Kurdish official Othman Sheik Issa said a new phase of the fight will begin against Turkey, threatening “hit-and-run tactics” to target Turkish troops and their allied forces. He said YPG fighters remain deployed in areas of Afrin.

“Our forces in all parts of Afrin will turn into a continuous nightmare for them,” said Mr Issa. “The resistance will continue in Afrin until it is all liberated and it goes back to its rightful owners.”

Afrin appeared largely empty. Salih Muslim, a senior Kurdish official living in exile in Europe, tweeted that Kurdish fighters had withdrawn from the town but that they will continue their fight.

Turkish TV filmed some residents celebrating the arriving troops.

Syrians fleeing fighting between Turkish troops and Syrian Kurdish militia rest in a field between Afrin and Azaz (DHA-Depo Photos via AP)Syrians fleeing fighting between Turkish troops and Syrian Kurdish militia rest in a field between Afrin and Azaz (DHA-Depo Photos via AP)

Azad Mohamed, a resident of Afrin who fled the fighting, said he spent two days on the road until he reached relatives in eastern Syria.

“It was collective displacement. There was an endless line along the road,” he said, adding there were still armed fighters when he left the town who had vowed to keep up the fight.

Mr Mohamed said he worried he will not be able to return home.

The Britain-based Syrian Observatory for Human Rights said nearly 200,000 people fled the Afrin region in recent days amid heavy air strikes, entering Syrian government-held territory nearby. Mr Erdogan has said the people of Afrin will return.

Mr Issa said more than 800 YPG fighters were killed in the 58 days of fighting, and estimated that 500 civilians were killed.

The Observatory puts the number of casualties at over 280 civilians, adding that more than 1,500 Kurdish fighters have been killed since January 20, when Ankara launched the operation, codenamed Olive Branch, against the town and surrounding areas. Turkey says it has taken all measures to avoid civilian casualties.

Forty six Turkish soldiers have been killed since Ankara launched Olive Branch.

Turkey-backed Free Syrian Army soldiers in the centre of Afrin, previously controlled by the Kurdish militia (Hasan Kırmızitaş/DHA-Depo Photos via AP)Turkey-backed Free Syrian Army soldiers in the centre of Afrin, previously controlled by the Kurdish militia (Hasan Kırmızitaş/DHA-Depo Photos via AP)

Soon after Mr Erdogan announced his forces and allied Syrian fighters had seized Afrin, footage by Turkey’s private Dogan news agency showed Syrian fighters shooting in the air in celebration.

Another Dogan video showed a Syrian fighter shooting at a statue symbolising the Kurdish new year celebrations also being held this week, before a bulldozer attempts to pull it down. The statue is of Kawa, a mythological figure revered by the Kurds.

Turkish government spokesman Bekir Bozdag tweeted that Turkey would take steps to restore daily life and ensure access to food and health care. “Our job is not done yet, we have a lot more work. But terror and terrorists in Afrin are over,” he said.

The army posted a video on social media showing a soldier holding a Turkish flag and a man waving the Syrian opposition flag on the balcony of the district parliament building with a tank stationed on the street.

The soldier called the capture a “gift” to the Turkish nation and to fallen soldiers on the 103rd anniversary of a famous First World War victory – the battle of Gallipoli, where the Ottoman Empire repelled an invasion by Allied forces after several months of heavy fighting.

Turkey fears the establishment of a Kurdish self-ruled zone in Syria that could inspire its own Kurdish minority to press for greater autonomy.

The Kurds are the largest stateless ethnic group in the Middle East, with some 30 million living in an area split between Iran, Iraq, Turkey and Syria.