Fresh clashes in Tunisia's Ben Guerdane area near the Libyan border left 10 jihadists and a soldier dead as thousands attended funerals Wednesday for victims of a major assault.
The assault, launched Monday on army and police posts and blamed by authorities on the Islamic State group, and ensuing unrest has left 46 jihadists, 13 members of security forces and seven civilians dead.
IS has taken advantage of Libya's chaos to gain an important foothold in the country and there are fears of its influence spreading into neighbouring Tunisia.
After fighting off Monday's fierce assault, Tunisian security forces have been hunting and clashing sporadically with jihadists in the area, where a nighttime curfew has been in effect since Monday.
Two "terrorists" and a soldier were killed on Wednesday when fighting erupted after jihadists tried to raid a building site in search of provisions, officials said. Another jihadist was shot dead while hiding in a house in the city.
Late on Tuesday security forces killed another seven jihadists hiding out in a house in the town of 60,000.
The defence ministry warned that those entering a designated buffer zone along the border without permission would be dealt with "firmly".
Authorities would respond "with force against anyone" who does not cooperate, the ministry warned.
"This is to prevent terrorist threats that could target our country through attempts at infiltration," it said.
There was a heavy security presence in Ben Guerdane and the border with Libya has remained closed since Monday.
Thousands still turned up for funerals of the victims of Monday's attacks, as the bodies of 11 people were buried in the town cemetery in an area newly designated "The Martyrs of March 7".
Mourning took place nationwide, and schools across the country held a minute's silence in memory of the civilians and members of the security forces killed in the assault.
At the Lenin school in central Tunis, pupils sang the national anthem and saluted the national flag before the solemn ceremony.
"It is vital to show students the importance of defending the nation, that the blood of martyrs did not flow for nothing," teacher Sonia El Kefi told AFP.
Signup to our newsletter and follow us on Facebook and Twitter!
"We will not allow terrorists to influence the minds of children."
One of the pupils, Aziz, said: "This is for the martyrs" and so the police "are aware that if they die, there will still be people standing behind them".
- Call for 'measured' response -
The authorities said Monday's attack was an "unprecedented" assault by IS aimed at setting up a new stronghold in the country across the border from Libya.
Prime Minister Habib Essid has said about 50 extremists were believed to have taken part in the attacks.
The apparent aim of the operation was to establish a "Daesh emirate" in Ben Guerdane, he said, using an Arabic name for IS.
Analysts said the coordinated attacks showed jihadists are keen to spread their influence from Libya to Tunisia and to set up a new stronghold in the country.
Residents of the town said the assailants appeared to be natives of the region.
They stopped people, checked ID cards apparently to seek out members of the security forces, and announced their brief takeover of Ben Guerdane as "liberators".
Jihadists have taken advantage of a power vacuum in Libya since the NATO-backed overthrow of longtime dictator Moamer Kadhafi in 2011 to set up bases in several areas, including near Sabratha close to the Tunisian border.
Tunisia has built a 200-kilometre (125-mile) barrier that stretches about half the length of its border in an attempt to stop militant incursions.
Michael Ayari of the International Crisis Group think tank said there was a danger that too strong of a crackdown by security forces could backfire.
"Security forces should react in a measured manner when questioning Ben Guerdane residents who may have lent logistic or other support to the IS raiding party," he said.
"The scale of the attack means they could number in the hundreds. A wave of mass and indiscriminate arrests accompanied by police brutality could polarise families, feed into residents' frustrations and increase support for IS in the future."