Last weekend, another unusual police operation took place in Gaziantep, when 45 people — including many Tajiks, some with their wives and children — were detained upon their arrival by bus from Istanbul. Some of the detainees told the police they had chosen to live in the "Islamic state" and that they were immigrating, while others admitted their intention to join jihad in Syria. The police said all those arrested face deportation .

In recent days, there have been reports of anti-IS operations by the Turkish police in various cities. On July 30, the Turkish media reported an anti-IS operation in Istanbul that resulted in the arrest of 30 people who were involved in organizing travel arrangements for Europeans to join IS in Iraq and Syria .

If the majority of Turks think of IS as a terrorist organization, then what's the legal reality? Since spring 2015, Turkish security services have been considering IS as a security threat; three months ago, the Chief of General Staff started issuing information about captured IS elements and for the past two months has been labeling IS a terrorist organization.

In June 2014, 70.7% of Turks labeled IS as a terrorist organization; when the poll was repeated in September 2014, this had climbed to 79.8%. Although there have not been any credible polls since then, it is likely this will be even higher now.

Is the Islamic State (IS) a terrorist organization? The Turkish people are left wondering because of the gaps between public perception and the legal system in Turkey.

What is the legal status of IS militants apprehended in Turkey? According to a gendarmerie officer at the Turkish-Syrian border, who spoke to Al-Monitor on condition of anonymity, the legal process applied to detained IS militants is subject to serious legal shortcomings. The officer divided detained IS militants into three categories: Turkish citizens; foreigners who have entered Turkey legally and whose passports have valid visas; and foreigners who entered Turkey illegally.

“Because of legal adjustments necessary to harmonize with the European Union, the authority of our security forces to check the identity of suspects and detain them has been restricted," he said. "For example, even if we know for sure that someone is an IS militant, we can’t touch him unless he has been involved in a violent crime in Turkey.”

Regarding Turkish citizens trying to go to Syria and Iraq illegally, an army officer serving with a border detachment told Al-Monitor, “The legal process on the ground is not helpful to the security forces. For example, if I see an unarmed Turkish citizen trying to cross to Syria there is nothing I can do if he is outside the military forbidden zone along the border [which is between 197-1,969 feet wide]. I can’t actually do anything even if I catch him inside the military zone because someone has instructed him … to say he is a tourist and has entered the military zone by mistake. We have no choice but to turn him over to the police, who will give him a small fine and let him go.”

For Turkish IS militants who are caught when trying to enter Turkey illegally from Syria and Iraq, this legal vacuum is most useful.

Sources along the border who spoke to Al-Monitor on condition of anonymity say lawyers who are IS sympathizers are patrolling the border and the minute they hear that an IS militant has been caught, they rush to the scene and offer free legal advice.

"It is interesting to observe that the IS militants crossing the border illegally are very well briefed about their legal rights. In their first contact with us, during their medical checks and when appearing before a prosecutor, they exploit the gaps in the legal system," a senior security official told Al-Monitor. "Over the past two years, I have seen hundreds of Turkish citizens who I know to be definitely IS militants let go. As security forces we are doing our best, but if we don’t have adequate legal support how efficient can we be as individuals? I know of tens of security officials who are being investigated because of complaints lodged against their efforts to curtail IS traffic."

In regard to foreign IS militants who have entered Turkey legally, a security official told Al-Monitor: “I’m amazed by how informed the apprehended foreigners are of the holes in Turkey’s legal system. For example, they all say that they are in Turkey as tourists, and that they had come to the border area out of curiosity with no intention to cross the border. Many lodge complaints against us of ill treatment , and they have strong legal counsel behind them. I think all of this is well organized."

Another security official told Al-Monitor how serious the situation is about foreign IS militants entering Turkey illegally: “IS militants crossing into Turkey illegally from Syria or Iraq are the worst group to deal with because their legal status is a total mystery. When you catch them, they never have identification on them. Then they give us false information. An Egyptian tells us he is a Yemeni, gives a false name and provides a plausible story. It takes on average three months to acquire the biometric data of these people and send it to the various countries for verification and wait for a response. Where are you going to keep these people and on what legal grounds? If you decide to deport them, no country will take them without proper identification. I can tell you that there are hundreds of IS militants in our detention centers and prisons waiting for months to appear before a judge."

Another official draws attention to the incredible workload of the courts and prosecutors in Kilis, a city closest to the border. “Without exaggeration, every day hundreds of cases arrive but there are not enough prosecutors, judges and court clerks. I can’t understand why the Ministry of Justice doesn’t send more personnel to this city,” he told Al-Monitor.

Although Turkey has not officially declared IS as a terrorist organization, under international pressure a decision was taken on Oct. 10, 2013, to “freeze the financial resources of persons linked to IS.”

Government officials referring to this official directive say that Turkey has declared IS as a terrorist organization, but this does not reflect the reality on the ground.

Then how can Turkey legally declare IS as a terrorist organization?

Legal experts think Turkey can do this by applying international legal texts and norms. Another approach could be to declare IS as a terrorist organization because of its violent acts in Turkey. As of today, there are two cases in Turkish courts involving IS: the armed IS attack on March 20, 2014, in the Central Anatolian province of Nigde that killed two security officials and a civilian and wounded eight people, seven of them soldiers; and the bomb attack last June 5, during a Peoples' Democratic Party rally in Diyarbakir that killed four and wounded about 100. But both cases are proceeding very slowly and are far from being transparent.

The Turkish legal system appears to be unwilling and too slow to declare IS as a terrorist organization.

Although the majority of Turks identify IS as a terrorist organization and the security services are introducing stiffer measures against IS, Turkey is not able to launch an effective struggle because of the gaps in the Turkish legal system, which the IS militants are thoroughly familiar with. If Turkey decides on a serious struggle against IS, what is needed first are changes in the penal code. Otherwise the Turkish public will applaud when IS militants are apprehended but will not know that most of them are released a short time later.