Turkey has opened its border along Syria to thousands of Kurds fleeing militants from the Islamic State group, Prime Minister Ahmet Davutoglu said Friday. The move came amid escalating clashes between Kurdish fighters and militants with the group, also known as ISIS or ISIL, in Syria.

"We will take in our brothers fleeing ... from Syria or any other place without any ethnic or sectarian discrimination," Davutoglu told reporters. "We have taken in 4,000 brothers. The number might increase. Their needs will be met. This is a humanitarian mission."

The policy shift saw thousands of people, mostly women and children, crossing into the south-eastern border village of Dikmetas under tight security Friday. In all, Turkey has taken in more than 847,000 Syrian refugees since the uprising against President Bashar Assad began in 2011. It has also become a reluctant ally to the U.S. against the growing fight to stop the Islamic State group.

While Turkey has maintained an open border with Syria throughout the conflict, it was unclear earlier this week how Turkey would respond to the hoards of refugees attempting to cross its border after fighters from the Islamic State group seized several villages on the Turkish-Syrian border. President Recep Tayyip Erdogan said Turkey was developing plans for a buffer zone on its porous 565-mile border with Syria. At one point, Turkish police and troops fired tear gas and water canons at Turkish Kurds protesting against Turkey's earlier refusal to welcome the refugees, local media reported.

ISIS is advancing its efforts in Syria even as President Barack Obama is preparing to launch a military campaign against the Sunni Muslim militants. The Islamic State group's mission is to create an Islamic caliphate across the Middle East.