Militants attacked a barracks in a Tunisian town near the Libyan border on Monday sparking heavy fighting in which four civilians, and 21 militants were killed, officials said.
It was the second deadly clash in the border area in less than a week, as Tunisia battles a spillover of violence from its neighbour.
A 12-year-old was among the civilians killed in Ben Guerdane, hospital official Abdelkrim Chafroud told AFP, adding that two security agents were also among the dead.
The defence ministry said that 13 militants and a soldier were killed as troops thwarted the attack on the barracks.
Six militants were also wounded and detained, defence ministry spokesman Rachid Bouhoula told AFP.
Army units were deployed across the town and set up roadblocks on access roads.
Witnesses said troops were using loudhailers to urge residents to stay indoors. The defence ministry appealed for information on any suspect activity.
Last Wednesday, troops killed five militants in a firefight outside the town in which a civilian was also killed and a commander wounded.
Troops have been on alert in the border area following reports that militants had been slipping across since a US air strike on an Islamic State group training camp in Libya on February 18 killed dozens of Tunisian militants.
At least four of the five militants killed in last week's firefight were Tunisians who had entered from Libya in a bid to carry out attacks in their homeland, the interior ministry said.
Deadly attacks by IS on foreign holidaymakers last year, which dealt a devastating blow to Tunisia's tourism industry, are believed to have been planned from Libya.
|Tunisia has built a 200-kilometre (125-mile) barrier that stretches about half the length of its border with Libya in an attempt to stop militants infiltrating.|
Tunisia has built a 200-kilometre (125-mile) barrier that stretches about half the length of its border with Libya in an attempt to stop militants infiltrating.
Last month's US strike on the IS training camp outside the Libyan city of Sabratha targeted the suspected mastermind of two of last year's attacks, Noureddine Chouchane.
Washington has said Chouchane was likely among the dozens of militants killed, and that the strike probably averted a mass shooting or similar attack in Tunisia.
Britain announced last week that it was sending a team of around 20 soldiers to Tunisia to train troops patrolling the border with Libya.
Thirty Britons were among 38 foreign holidaymakers killed in a gun and grenade attack on a beach resort near the Tunisian city of Sousse last June.
And last March, gunmen killed 21 tourists and a policeman at the Bardo Museum in Tunis.
According to a UN working group on the use of mercenaries, more than 5,000 Tunisians, mostly aged from 18 to 35, have travelled abroad to join militant groups.