Syrian Kurds walk through Mursitpinar border crossing to return to their homes in the Syrian city of Kobani
Syrian Kurds walk through Mursitpinar border crossing to return to their homes in the Syrian city of KobaniReuters

The Turkish parliament passed a motion on Thursday 2 October authorising the military to enter Iraq and Syria to fight the Islamic State group, and allows for foreign troops to use Turkish bases.

The vote marked the first time the Turkish government has shown it is committed to fighting the Sunni militant group also known as Isis, which has taken control of large swaths of Iraq and Syria.

The Islamic State group has now fought its way to Kobane, Syria, just a few miles from Turkey, the closest it has ever been to the territory of a nation that is both a Nato ally and on the doorstep of Europe.

In many ways, the future of the fight against IS rests in Turkish President Recep Tayyip Erdoğan's hands, Luay al-Khatteeb, director of the Iraqi Energy Network, a consultancy that advises the Iraqi parliament, said. The US-led coalition is not only dependent on Turkey for stopping the flow of fighters and weapons into Syria but also relies on its security forces on the border to shut down the Isis oil trade.

Until now, Turkey has shied away from intervening in the Syrian conflict, claiming it was too consumed with hosting the hundreds of thousands of refugees from that war who are seeking shelter on Turkish territory.

But now hardline extremists have gained momentum and the Free Syrian Army, the coalition of moderate rebels in the Syrian civil war that is receiving US aid, has fallen behind. Fighting on two fronts, against President Bashar Assad's forces and extremist groups, they have lost control of key border crossings with Turkey.

At the end of March 2012, fighters with the Syrian opposition witnessed the first sign that the extremist forces they had warned the US about were organising near the Turkish border. A black flag, now the emblem of IS, flew on a pole next to the Bab al-Hawa checkpoint, one of the main entryways into Syria from Turkey. Now those extremists, who have morphed into the Islamic State group, are just a short drive from confronting Turkish forces on the border.

Extremists from the al-Qaida-affiliated Al Nusra Front and IS are using their control of checkpoints on the border with Turkey to finance their fight in Syria through a lucrative smuggling network. Their leaders also regroup and meet inside Turkey, using its territory as their de facto command center, safe from Syrian government attacks and from the Free Syrian Army moderate rebels, said Rami Jarrah, a Syrian activist and journalist.

In recent weeks, Turkey has been accused of allowing IS fighters to cross through the border and sell oil from the fields they captured in Iraq and Syria on its black market.

Airstrikes on refineries have severely curtailed Isis oil revenue but IS has occupied and holds towns around Kirkuk, in Iraqi Kurdistan, a major oil hub. From there it has the potential to tap into the production process and get into the distribution of crude. Turkish border guards have seized recently 1,400m of pipeline, or almost a mile, at crossings, in an indication that IS may be trying to build its own oil distribution.

Speaking at the World Economic Forum in Istanbul earlier this week, oil analysts said that the more immediate concern for Western nations is the risk that IS may interrupt the flow of oil from Iraqi Kurdistan into Turkey, which then goes on to the European market.

In 2013, the Kurdistan Regional Government in Iraq completed the construction of a pipeline on the Turkey-Iraq border that connects to the Kirkuk-Ceyhan pipeline. The pipeline has a capacity of about 150,000 barrels a day, and it lies in territory that may soon be captured by IS.

Ibrahim Kalin, Turkish assistant undersecretary of state and senior adviser to the prime minister, said Turkish security forces "register every person that comes through, even if they do not have papers".

At the eight border crossings they control, they have stopped close to 6,000 foreign fighters who were trying to enter Syria. According to the Turkish Armed Forces, between 19 and 25 September, security forces on the Syrian border detained 1,061 people and seized goods including guns and hand grenades.

Oytun Orhan, a researcher at the Center for Middle Eastern Strategic Studies in Istanbul, said Turkey is not aiding IS and that the allegations are "misguided".

"In an environment where people flock to fight for Isis from all around the world through different channels, it is unrealistic to forge a direct link between Turkey and Isis," he wrote in a recently published paper.

Although Turkish officials said they have established a formula for tracking down smugglers and stopping extremist foreign fighters from entering Syria, they have not completely quelled the IS threat. Just two days ago, IS fighters were captured on camera entering Syria from Turkey to fight in Kobane.

But if the opposite happened -- if IS fighters entered Turkey in arms, or attacked Turkish forces inside their territory -- then Turkey could rely on the support of Nato. The secretary-general of the alliance, Jens Stoltenberg, said this week that Nato would defend Turkey against any attack. He said: "Our responsibility, the basic responsibility, is to stand up and be very clear that we are going to protect Turkey."