A militant linked to Al-Qaeda in the Islamic Maghreb blew himself up and another was shot dead on Sunday during an operation by Tunisian security forces, the national guard said.
Both were "dangerous terrorist elements", and one, probably a foreigner, was a leader in a group linked to AQIM, national guard spokesman Khalifa Chibani told AFP.
The operation took place in the central town of Sidi Bouzid when a house was raided in a security sweep after weeks of surveillance, he said.
"A terrorist group was attacked in a national guard operation," Chibani said, using Tunisia's designation for Islamist militants.
"Units had discovered contacts between the Okba Ibn Nafaa Battalion (a group connected to Al-Qaeda) and people inside Sidi Bouzid."
An AFP correspondent said security forces surrounded a house in the Ouled Chebli district and shots were heard.
During the assault, one militant "was hit and blew himself up", Chibani said.
The other man killed had also been wearing an explosives belt but was shot dead before he could detonate it.
Chibani said the group had been planning "terrorist operations during Ramadan", the holy Muslim fasting month that begins at the end of May.
Another three people suspected of links with the group were detained and security forces were hunting for other suspects.
Since its 2011 revolution, Tunisia has experienced an increase in militant attacks that have cost the lives of dozens of members of the security forces and also 59 foreign tourists.
Despite a halt to major attacks, the country has been under a state of emergency since November 2015, when a suicide bombing in Tunis claimed by the Islamic State militant group killed 12 presidential guards.