BEIRUT (Reuters) - Turkey s military has begun setting up observation posts in northwest Syria s Idlib province, its General Staff said on Friday, part of a deployment that appears partly aimed at containing a Kurdish militia.  Turkey sent a convoy of about 30 military vehicles into rebel-held northwest Syria through the Bab al-Hawa crossing in Idlib, rebels and a witness said.  Video distributed by the Turkish army showed what it said was the convoy starting to move on Thursday night, with military vehicles traveling along a road in darkness.  Turkey says its operation, along with Syrian rebel groups it backs, is part of a deal it reached last month with Russia and Iran in Astana, Kazakhstan, to reduce fighting between insurgents and the Syrian government.  The army said its forces in Syria were conducting operations in line with rules of engagement agreed with Russia and Iran.  However, the deployment is also intended to rein in the Kurdish YPG militia, which holds the adjacent Afrin region, a senior rebel official involved in the operation said.   (It is) in line with Astana 6 resolutions to ensure the area is protected from Russian and regime bombing and to foil any attempt by the separatist YPG militias to illegally seize any territory,  said Mustafa Sejari, an official in a Free Syrian Army (FSA) rebel group.  Broadcaster CNN Turk reported on its website that there was a clash in Idlib countryside near the Ogulpinar border post in Turkey s Reyhanli district.  It said the sound of  doshka  (machine-gun) fire from across the border could be heard in Reyhanli district and it was not clear which forces were clashing. The convoy was heading toward Sheikh Barakat, a high area overlooking rebel-held territory and the Kurdish YPG-controlled canton of Afrin, the witnesses said.   President Tayyip Erdogan announced the deployment on Saturday, saying Turkey was conducting a  serious operation  with rebel groups it supports. Turkey has supported rebels fighting Syrian President Bashar al-Assad throughout the war. But since last year Ankara has focused on securing its border, both from jihadists and from Kurdish forces that control much of the frontier area inside Syria.  Sejari, the rebel official, said it was important to contain the YPG to prevent any new military offensive to reach the Mediterranean, something that would require it to capture swathes of mountains held by rebels and Syria s army.  Today we can say that the dream of the separatists to reach the sea and enter Idlib and then to Jisr al-Shaqour and the coastal mountains has become a dream,  he said  Turkey regards the YPG as an extension of the PKK, a Kurdish group inside Turkey that has been waging armed insurgency against Ankara for three decades.   We said we may come unannounced one night, and tonight our armed forces started the operation in Idlib with the Free Syrian Army,  Erdogan said in a speech to his AK Party on Friday.   We are the ones with the 911 km border with Syria, the ones who are constantly under threat,  he added, noting the YPG s presence in Afrin.  As the strongest part of the Syrian Democratic Forces (SDF), the YPG has received military aid from Turkey s NATO ally the United States to fight Islamic State.  Last year, Turkey launched the Euphrates Shield operation, an incursion into northern Syria alongside Syrian rebel groups to take territory on the frontier from Islamic State.  That operation was also aimed at stopping the YPG using its own advances against IS from linking Afrin with the much larger area it controls in northeastern Syria.  In the area taken by the Euphrates Shield campaign, Turkey has made changes to local governance that indicate it may be laying a foundation for long term ties with that part of Syria. The Astana agreement with Assad s foreign allies Russia and Iran involves reducing fighting in several regions of Syria, including Idlib and adjacent swathes of the northwest, the most populous rebel-held area.  