In recent years, Turkey has been criticized for doing too little to stop jihadi fighters from moving between the Mideast and Europe. Its more than 500-mile border with Syria has come in for particular scrutiny throughout the five-year Syrian conflict.
But Turkey says it has deported thousands of suspected foreign fighters or Islamic State supporters since 2011 — nearly 3,300 of them, according to a recent estimate. Many came originally from Europe.
One of them was Brussels suicide bomber Ibrahim el-Bakraoui. After Tuesday's attacks, Turkish officials announced that Bakraoui had been picked up last summer in Gaziantep, not far from the Syrian border in southern Turkey, and deported to the Netherlands at his own request.
Turkish President Recep Tayyip Erdogan says his country warned both Belgium and the Netherlands of Bakraoui's terrorist links. Erdogan repeatedly criticized both countries this week for failing to heed these warnings. Two Belgian cabinet ministers offered to resign over the Brussels attacks; their offers were not accepted.
Turkey has been under steady pressure to get control over the movement of foreign and Syrian fighters between Syria and Turkey. The government denies being lax — but border controls have tightened noticeably in the past year, experts say.
"I believe Turkey is definitely getting better at patrolling the border," says Soner Captagay, of the Washington Institute for Near East Policy. "Obviously, Turkey realizes that it has an ISIS problem. But it will be a long time before this becomes a sealed border, if ever."
Terrorism Crisis Complicates Migrant Crisis
Border security is also an issue in the ongoing migrant crisis confronting Europe. Leaders of the European Union recently struck a deal with Turkey to stem the flow of migrants toward the continent.
The agreement promises Turkey billions of dollars in exchange for a "one-for-one" swap proposal, under which Turkey would accept economic migrants being turned back from Greece while the EU would welcome an equal number of refugees from Turkish camps.
But human rights and humanitarian aid groups have called this deal immoral, cruel and in some respects, illegal. They question whether Turkey is really a "safe third country" for refugees, as required by international law.
Reports in recent months that terrorists who struck Paris and elsewhere may have crossed into Europe on the migrant trail have increased European calls to close borders, build walls and cut off the migrant flow.
As a result, Turkey faces conflicting pressures: EU countries are demanding that it seal the Syrian border and catch would-be terrorists before they attack, while international law and aid groups are calling for it to take the humanitarian path and offer refuge and shelter to those fleeing carnage and chaos in Syria.
Turkey says if European security forces kept better track of would-be jihadi fighters, more of them would be stopped — either before they left their home country or once they reached Turkey. That, however, would depend on a level of intelligence-sharing that so far has been lacking.
Sinan Ulgen, a Turkey analyst and visiting scholar at the Carnegie Endowment for International Peace, says Turkish officials are rightly sensitive, and perhaps even a bit defensive, about the criticism of their country's border policies.
"Their almost instinctive reply is, 'Look at the U.S., how effective is the U.S. in protecting its border with Mexico?' " he says. "So I think the expectation from Turkey is to do better — but not necessarily to provide an absolute degree of control over the border, which is impossible, given the geography and the length."