Fresh violence erupted Wednesday at Ben Guerdane near Tunisia's border with Libya, as a "martyrs'" funeral was held and amid nationwide mourning after a Islamist militant assault killed more than 50 people.
The defence and interior ministries said two "terrorists" and a soldier were killed in a firefight in the Oued Rbyaa area.
They said the confrontation came after militants on the run raided a building site in search of provisions and stole food from workers there.
A civilian was also wounded, a joint statement said.
The clash came as thousands of mourners gathered in Ben Guerdane, near the border with conflict-ridden Libya, for the funerals of people killed in Monday's full-blown militant attack on the town of some 60,000 residents.
Schools across the country held a minute's silence in memory of the seven civilians and 12 members of the security forces killed in the assault that the authorities blamed on the Islamic State (IS) group.
Thirty-six militants were also killed.
Since the militant dawn attack on an army barracks and police and National Guard posts in Ben Guerdane, the number of dead militants has risen to 45 after another seven were killed overnight.
Four Kalashnikov assault rifles were recovered, the ministries said of the nighttime clashes in the Benniri area, a few kilometres (miles) south of Ben Guerdane.
Security forces have flooded Ben Guerdane over the past two days as mopping up operations continue and an overnight curfew was imposed on residents.
The authorities said Monday's attack was an unprecedented assault by IS group aimed at setting up a new stronghold in the country across the border from Libya, where the group already has a presence.
Schools nationwide observed a minute's silence early Wednesday ahead of funerals for some of the victims.
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.
"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".
In Ben Guerdane itself on Wednesday morning, thousands of residents attended the funerals of some of the victims, an AFP correspondent and a security source said.
The security source said the bodies of 11 people were buried in the town cemetery in an area newly designated "The Martyrs of March 7".
Prime Minister Habib Essid said on Tuesday about 50 extremists were believed to have taken part in the assault on Ben Guerdane the day before.
On Monday, he said the apparent aim of the operation had been to establish a "Daesh (IS) emirate" in Ben Guerdane.
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.
President Beji Caid Essebsi has described the attack on Ben Guerdane as "unprecedented" and said it was "maybe aimed at controlling" the border region.
He vowed to "exterminate these rats".
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 Muammar Gaddafi 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.