GAZIANTEP, Turkey (Reuters) - As U.S.-led coalition jets from a Turkish air base began to pound Islamic State targets in Syria in the summer of 2015, Ilhami Bali passed on what appeared to be an order from the militant group's leadership in Raqqa: unleash war on Turkey.
Bali, identified by Turkish prosecutors as the most senior Islamic State figure in Turkey, asked a fellow militant in the border city of Gaziantep to draw up a list of potential targets. Cash, suicide bombers and equipment would be sent from Syria, he said.
"Turkey has waged war on us ... so we're waging war back," the Turkish national wrote in an email from Syria, according to documents prepared by Ankara prosecutors and reviewed by Reuters. "I asked who should we hit and they say it does not matter; be it PKK (Kurdish militants), be it Turkish soldiers, be it tourist spots. Whatever you have planned."
The email was sent to Yunus Durmaz, who prosecutors say co-founded Islamic State's Gaziantep cell along with Bali. Durmaz provided a long list of possible targets, including NATO Patriot missile batteries, foreign missions, U.N. offices and a popular nightclub in the Mediterranean resort of Antalya.
Documents that form part of a judicial investigation into the cell, which Turkish prosecutors say carried out at least two major bombings last year, give a rare insight into the genesis and operations of the wider Islamic State network in Turkey.
Islamic State has grown increasingly active in Turkey, according to the government which blames it for seven suicide bombings across the country over the past year, though the group has not claimed responsibility for the attacks.
The prosecution documents show how suspected members of the Gaziantep cell set up safe houses to accommodate fighters, facilitated the passage of some to Syria, rented depots to store weapons and ammunition, paid salaries, kept records of expenses and made bombs and suicide vests with components purchased inside Turkey.
Having a strong presence in Turkey has been crucial to Islamic State's Middle Eastern battle plans and their attempts to strike at the West, as they use the NATO country as a transit route for fighters and equipment.
Hundreds of Turks have been recruited to fight in Syria, while weapons experts say Turkey has become the most important source for components to make improvised bombs used by Islamic State forces.
Turkey has also been used as the gateway between the group's territory, in Iraq and Syria, and Europe - where it has carried out attacks in countries including France and Belgium. The country is also traditionally a popular destination for Western tourists, who have been struck in at least two of the Turkish bombings blamed on Islamic State earlier this year.
The documents regarding the Gaziantep cell were prepared by prosecutors based on suspects' testimonies, email exchanges, security camera footage and digital evidence collected during police raids.
An official at Ankara's main courthouse verified the documents were genuine. The Ankara prosecutors' office could not be reached for comment on the cell or the investigation.
Turkey, initially seen by Western allies as a reluctant partner in the fight against Islamic State, stepped up its campaign in July 2015 by opening by its Incirlik air base to the U.S.-led coalition, making bombing raids on the group's positions in northern Syria easier and more frequent.
The country then became a primary target.
"The planes are hitting us here more," Bali wrote to his fellow Turkish national Durmaz in the email last summer. "I know you have a tough job, but console the hearts of devout Muslims. Hit them ... so we can be happy."
The Turkish attacks blamed on Islamic State have been a factor in Turkey's decision to send troops and tanks into northern Syria for the first time last month in an attempt to drive back the group from its border.
Bali and Durmaz's Turkish cell carried out at least two major bombings, the prosecution documents say: one in July 2015 in the southeastern town of Suruc, where 35 mostly Kurdish activists were killed, and a twin suicide attack in Ankara last October, when more than 100 people died.
Durmaz was also the mastermind of two more attacks carried out earlier this year, Gaziantep governor's office said in a statement on Thursday.
The two men, helped by a core of around a dozen accomplices, trained at least 150 fighters for attacks across Turkey, according to the documents. Their cell ran at least two safe houses and four depots in Gaziantep.
The group bought at least 1.5 tonnes of ammonium nitrate - a chemical used in agriculture but also to make bombs. Police have also seized hand grenades, machine guns, ammunition and bombmaking components such as fuses, ball bearings and explosives in raids on the cell since last October.
"Data points to Turkish Islamic State members manufacturing explosives inside Turkey, including the vests used in at least three, but perhaps more, attacks inside Turkey since 2015," said Aaron Stein, a Turkey specialist at the Atlantic Council, a Washington-based international affairs think-tank.
"The vests are far better constructed than the ones used by Islamic State in France and Belgium. These guys are far better trained in bombmaking."
A February report by the UK-based Conflict Armament Research said Turkey was a hub for acquiring bomb-making components which can then be shipped to Syria and Iraq.
"Turkey is the most important choke point for components used in the manufacture of improvised explosive devices by Islamic State forces," it said.
The seven suicide bombings blamed on Islamic State in Turkey since July 2015 have killed more than 250 people. But the group has not claimed responsibility for any of them.
This may be a deliberate strategy, experts say, by a group which has boasted about bombings elsewhere in the world.
"They are connected with Raqqa," said a senior security official who declined to be named due to the sensitivity of the matter. "The bombings are a result of instructions from their leaders."
"But they see Turkey as a recruitment area and they don't want to openly say they are targeting a Muslim society. Leaving it as a question works better than spelling it out."
Such considerations may also explain why the targets in Turkey have largely been Kurdish interests or foreign tourists.
Suspected cell member Yakub Sahin said in testimony to prosecutors that he was told that rallies in Suruc and Ankara were targeted because they were members there of the Kurdistan Workers Party (PKK), an outlawed group fighting the Turkish state for Kurdish autonomy.
"They are all enemies of God," Durmaz is said to have told Sahin when he expressed doubt over the killing of civilians.
The PKK is closely linked to Kurdish militia fighters in Syria fighting Islamic State. The Suruc and Ankara rallies were both attended by largely civilian pro-Kurdish activists.
It is unclear when the Gaziantep cell was founded, but police began monitoring some members in 2012. Some suspects were detained last year and at least eight have fled to Syria, according to media reports and a police source.
Durmaz himself was killed in May when he detonated a suicide vest he was wearing during a police raid on a Gaziantep safe house. Bali's whereabouts are unknown.
The Gaziantep governor's office declined to comment on the investigation into the cell.
Prosecutors, who launched the investigation after the Ankara bombing last October, say the cell used safe houses to accommodate fighters - both those smuggled into Turkey from Syria, and others en route to Syria to fight for Islamic State.
Hundreds of Turkish citizens are thought to have traveled to fight in Syria over the past four years.
In 2012-2014, many joined Islamist groups including Jabhat al-Nusra fighting against Syrian President Bashar al-Assad - who Turkey wants to see ousted. Some later shifted to Islamic State after the group proclaimed its caliphate in 2014.
Turkish officials say at least 700 Turks have joined Islamic State, but some diplomats say the number could be more than 10 times that.
"There was no secret," said one resident in the sleepy border town of Elbeyli, adjacent to Islamic State-held territory, describing vehicles regularly crossing the border at night. He declined to be named for fear of retribution.
"Some people made a fortune out of this and there is still demand. Unless you wipe out its roots, it will not end."
Editing by Nick Tattersall and Pravin Char