BEN GUERDANE, Tunisia, May 24 (Reuters) - After a U.S. air strike killed a Tunisian jihadist commander in western Libya in late February, dozens of Islamic State fighters sneaked across the border into Tunisia and attacked an army barracks and police bases in the town of Ben Guerdane.
In the battle that followed, Islamic State militants shot dead local Tunisian anti-terrorism chief Colonel Abdel Atti Abdelkabir meters from his home. Residents, including the colonel's brother, say they recognized some of the attackers as former neighbors and classmates who had left to train with Islamic State in Libya. In all, more than 50 militants died in the assault.
The battle was further evidence of how Libya's chaos has spilled over into its more stable neighbor. Tunisia, one of the most secular countries in the Arab world, is trying to nurture the nascent democracy that grew out of its 2011 uprising against the government of Zine El-Abidine Ben Ali. But it also faces an intensifying battle against Islamist militants - not least Tunisian fighters now based just across the border.
"We're sitting right next to a nation that has no peace," Abdelkabir's brother Hussein told Reuters in the family home. "My brother was directly targeted. He said they would come to attack one day and they came for him."
Tunisia's 2011 uprising created fertile ground for jihadist recruiters. Hundreds of Islamist militants were freed from prison as part of an amnesty for those detained under Ben Ali. Ultra-conservative salafists began to flex their muscle, seizing control of mosques and clashing with secularists. As Tunisia's politics have stabilized, the government has reasserted control, taking back mosques, banning the local al Qaeda affiliate Ansar al Sharia, and forcing many militants to flee.
At first the jihadists mostly headed to Syria. But now Libya is more popular with them - many Tunisians have become key figures in Islamic State there. In all, officials estimate that between 4,000-6,000 Tunisians have left to fight for Islamic State and other groups, among them university graduates and professionals recruited online.
The flow continues. Since last summer, for instance, nearly 80 young Tunisians from Remada, a town two hours south of Ben Guerdane, have crossed into Libya, according to residents there, spirited along the same desert scrubland tracks used by traffickers to ferry cheap Libyan fuel into Tunisia.
Related: See the history of the Islamic State through photos:
Over the past year or so, some militants have begun to return. Security forces say recent attacks on a beach hotel and a museum were carried out by Tunisian gunmen who had trained in Libya. Earlier this month, more than 20 suspected militants were arrested in Tunis. They are believed to have brought explosives from Libya for attacks on the capital, the government said.
The Tunisian jihadist commander killed in the U.S. air strike on Sabratha was Noureddine Chouchane. He trained gunmen in his Libyan camps to kill foreign tourists in Tunisia, according to U.S. and Tunisian officials. A former senior member of Ansar al Sharia, Chouchane had also become a key recruiter for Islamic State.
Among those who joined him were his wife, Rahma, 17, and her sister, Gofran, 18, the girls' mother told Reuters. She said the two were typical music-loving teenagers. But after meetings with local Ansar al Sharia recruiters in 2013, they became more conservative, demanded a ban on television at home and harassed their mother to wear more modest headscarves.
Last year, they both left for Libya. They are now held in Maitiga prison in Tripoli, after being arrested by local forces there.
"Rahma always told me she was proud of what she was doing," her mother said in the family home in Tunis, where two younger sisters still live. "After the Sabratha strike, she said she wanted to come back."
Ben Guerdane, a dusty town of one-story buildings, has a long history of supplying jihadists going back to the 1980s, when Tunisians fought in Afghanistan. Later it sent fighters to Iraq where they fought U.S. troops.
Its inhabitants now feel a kind of war has come to them. A mosque minaret used by jihadists as a base during the attack is pockmarked by dozens of bullets fired from a helicopter, and several white villas have been damaged by grenade explosions.
"Libya is just there, 30 kilometers away, it's easy for them to come here, and they knew exactly where they needed to go when they came," said Hamid Ishi. His home is charred by bullets and has a gaping hole from a tank shell.
Security sources say several arms caches were in place before the March attack. Some militants arrived in an ambulance and then used Ishi's home as cover to fire on the barracks. Others set up roadblocks and demanded documents.
"They asked for my papers and told me to go home, saying they were from Islamic State, here to free us from tyrants," said Hedi Grisia, a telecoms worker. "I recognized one of them. He hadn't been around for a few years."
Hussein, the counter-terrorism chief's brother, said he recognized at least one of the gunmen who came to his home.
He also went to school with militant commander, Meftah Ben Hassine Ben Mohamed Manita. A Ben Guerdane native and former Ansar al Sharia member, Manita was jailed in 2007 after an Al Qaeda insurrection and released in 2011 along with other Islamists during the amnesty, a security source said.
"He joined Daesh after being a member of Ansar al Sharia," said the Tunisian security source, using one of the Arabic names for Islamic State. "He fled to Libya after the government made Ansar al Sharia a terrorist group."
To stop its jihadists returning, Tunisia is reinforcing its border. The army has built a 200-km earthen berm and trench along part of the frontier. British and German troops are also training Tunisian forces in border protection and surveillance.
Under a state of emergency declared last year and since extended, hundreds of suspected militants have been rounded up, leading rights activists to worry that repressive tactics may fuel more militant recruitment.
Tunisian security officials, analysts and diplomats say that since the first attacks early last year, the army has progressed in counter-terrorism and special forces operations. Intelligence networks are growing, if slowly.
"Today we are more worried about suicide attacks, and sleeper cells and lone-wolf style attacks that could strike at any time," a senior Tunisian security source said.
The ministry of religious affairs last month started a program to promote moderate imams. The European Union has promised funding for deradicalisation programs, though they are still in their infancy.
Officials say that border towns need moderate messages, economic development and jobs.
Sitting in parched flatlands, Remada, one such town, has a short main street with an army barracks, houses and a few stores. Small plantations of olive trees surround the town and disperse into the desert and hills beyond.
Two ministers flew into town last month to talk to young men about economic development. Many locals dismissed the visit as more promises from northern politicians who have abandoned the south.
"There is nothing for young people here, they just look for an alternative, something to do," Yarusi Kadi, an unemployed 21-year-old said of those who join Islamic State. "It's almost like a revenge against themselves - to prove something, some worth."
Bechar Zongya, a former smuggler who police say became an Islamic State commander in Sirte, grew up on an olive tree plantation. His father Yahya still works there.
Last summer, police and residents say, Zongya helped lead a group of 30 people, including an air force pilot, two soldiers and an oil engineer, across the border into Libya to join Islamic State. Since then, other groups have left, too.
Yahya denies his son is a jihadist commander but said he had long been harassed by police for wearing his beard long and for his conservative views.
"If you put yourself in his place, with the arrests and the abuses, the treatment he got, what do you think would be the result?" his father said of his son. "You might find yourself joining one of these groups, too."