Syria's foreign ministry has condemned Turkey's shelling of Kurdish fighters in northern Syria and sent two letters voicing its concern to the United Nations, Syrian state media reported.

"Turkish artillery shelling of Syrian territory constitutes direct support to the armed terrorist organisations," the ministry told the UN secretary general and the Security Council's chairman on Sunday.

In the past two days, Turkish forces have shelled Kurdish-held areas in Syria's northern province of Aleppo, as it urged fighters with the Syrian Kurdish People's Protection Units (YPG), the armed wing of the Syria's Democratic Union Party (PYD), to leave areas it had captured there.

"The Syrian government expresses strong condemnation of Turkey's repeated attacks on the Syrian people and its transgression into the Syrian territory, calling these attacks a gross violation of the Syrian sovereignty and a flagrant breach of the UN Charter's objectives and principles, the rules of the international law and the Security Council's counterterrorism resolutions," the letters said.

The shelling came after Ahmet Davutoglu, the Turkish prime minister, warned on Saturday that Ankara would, if necessary, take military action against PYD fighters if they do not retreat from the territories they gained in the past few days from Turkish-backed Syrian armed groups..

Peace hopes fade as Syrian army tightens grip on Aleppo

The YPG is in control of almost all of Syrian-Turkish border and, in recent days, the group and its allies have expanded their territorial gains by taking advantage of a major Russia-backed government offensive in Aleppo.

Turkey considers the PYD and its YPG militia to be branches of the PKK, which has waged a decades-long armed campaign against the Turkish state.

The PKK is seen as a "terrorist organisation" by the U.S. and EU, while the PYD is not.

'We won't retreat'

On Sunday, Kurdish-backed fighters said they will not withdraw from the areas they have recently captured in the country's north.

Taj Kordsh, a Syrian Democratic Forces (SDF) spokesman, told Al Jazeera on Monday that the group has captured almost half of Tal Rifaat, a town in Aleppo's northern suburbs, on Sunday evening.

"Despite Turkey's shelling, we are advancing and have captured the town's train station. We will retaliate if the shelling continues," Kordsh said.

The YPG, Jaish al-Thuwar and other Kurdish groups are part of the SDF, a coalition founded in Syria's mainly Kurdish northeastern region in October 2015.

"Dozens of fighters from the al Nusra Front from and Ahrar al-Sham have been killed in the clashes, and until now, heavy clashes are taking place," Kordsh added.

Opinion: The Syrian Civil War has become a perpetual conflict

Speaking to Al Jazeera from Afrin on Sunday, Tarek Abu Zeid, a spokesman of Jaish al-Thuwar, a YPG ally, said: "We recently captured Menagh airbase, and we are close to capturing Tal Rifaat."

Referring to the Islamic State of the Iraq and Levant group, he said: "Our aim is to reach ISIL-controlled territories.

"We want to fight this terrorist group. Turkey wants us to return to Afrin. This won't happen. We are advancing, we won't retreat."

Additional reporting by Al Jazeera's Diana Al Rifai