Tunisia's prime minister, Ali Larayedh, says Islamist militants are exploiting anarchy in neighbouring Libya to get training and smuggle weapons across North Africa's porous borders.
His coalition government is grappling with an Islamist militant group known as Ansar Al-Sharia, which is one of the most radical to emerge since Tunisia's 2011 uprising against autocratic former president, Zine El-Abidine Ben Ali.
Security is a sensitive matter for Larayedh's ruling moderate Islamist party, Ennahda, which has agreed to step down in three weeks to end months of unrest set off by the assassination of two secular leaders by Islamist militants.
As well as Ansar Al-Sharia, North Africa is home to Al-Qaeda in the Islamic Maghreb and other Islamist militants such as those led by veteran commander Mokhtar Belmokhtar, who claimed responsibility for the attack on Algeria's Amenas gas plant in January, in which nearly 40 foreign workers were killed.
France's military campaign to oust Al-Qaeda-linked Islamist fighters from Mali this year prompted some to enter southern Libya, where the government in Tripoli exerts scant control.
"There is a relation between leaders of Ansar Al-Sharia, Al-Qaeda in the Islamic Maghreb and Ansar Al-Sharia in Libya. We are coordinating with our neighbours over that," Larayedh, who was interior minister before becoming premier, told Reuters.
"Extremists in Tunisia have profited from the situation in Libya and they get their weapons from Libya. They have benefited and they have gotten training in Libya," he added.
Larayedh, who spent more than a decade in prison for being a member of a banned Islamist party before the uprising, was speaking shortly after Tunisian forces killed 10 members of Ansar Al-Sharia near Goubellat close to the Algerian border.
Tunisian authorities said gunmen had attacked two police patrols in the north of the country and had been planning assaults on security force buildings and the military.
It was the worst violence in Tunisia since Larayedh's government declared Ansar Al-Sharia a terrorist organisation two months ago, accusing it of assassinating Chokri Belaid and Mohamed Brahmi, two secular opposition leaders.
Ansar Al-Sharia's leader in Tunisia is a former Al-Qaeda fighter in Afghanistan, and is accused of inciting his followers to attack the US Embassy compound in Tunis a year ago.
"We are chasing down the last members of this group Ansar Al-Sharia. We are advancing in this war," Larayedh said in interview at his presidential office in Tunis.
He said more than 300 members of the organisation had been arrested since the crackdown began.
Tunisian forces have been bombarding Islamist militants in the Chaambi Mountains near Algeria. The militants, who holed up there after the French offensive in Mali, killed eight soldiers in Chaambi in July, some of whom had their throats slit.
Sticky political transition
Tunisia, where a series of Arab uprisings began in 2011, had been seen as a regional model, and its transition to democracy remains less violent than those in Egypt and Libya.
But Islamists, who were long oppressed under Ben Ali, have gained influence, fuelling debate about the role of political Islam in one of the Muslim world's most secular countries and one with the strongest ties to Europe.
Salafi Islamists have prevented concerts and plays being staged in some cities, and attacked alcohol vendors, saying the violate Islamic principles. For secular Tunisians, Islamists want to impose strict Sharia or Islamic law, which they feel threatens liberal education and women's rights.
Ennahda itself is split between conservatives and moderates.
Critics of Larayedh, a quietly-spoken man with glasses and a small moustache, say he is an uncompromising hardliner. But the former maritime engineer has taken some conciliatory steps, appointing political independents to major cabinet posts when he took office in February.
Ennahda's chairman, Rached Ghannouchi, who spent many years in exile in Britain, has long promoted a moderate form of political Islam which he says can work with modern democracy.
Ennahda won 40 percent in Tunisia's first post-revolution election for an assembly to draft a new constitution. It formed an interim coalition government with two secular parties.
But the political transition was knocked off track by the assassination of the two opposition leaders, which enraged those who believed Ennahda was too lenient on Salafi Islamists blamed for the killings and other attacks on secular Tunisians.
Now Ennahda has agreed that the government it leads will step down after three weeks of talks that start on Wednesday to form a caretaker government, set up an electoral commission and decide on a date for fresh elections.
"The government is ready to give up power in three weeks from the start of the talks. I am ready to give up my post even before the three weeks," said Larayedh.
Ennahda was one of the first Islamist parties to rise to power in the region after 2011, when many of its leaders gained government posts after years in jail or overseas exile.
Although its popularity has eroded during its period in power, Ennahda remains the best organised political movement in Tunisia. It faces several leftist and secular groups, as well as Nida Tounes, a party that includes figures from the Ben Ali era.
"This is a not a loss, more a part of the transition," Larayedh said of the government's resignation. "What our country needs is stability."
Short link: