Tunisia’s president has announced three days of national mourning for eight officers killed by suspected militants in the central Sidi Bouzidi province.
President Moncef Marzouki was speaking on the second anniversary of the country’s first free elections.
Earlier, PM Ali Larayedh confirmed the government would resign after talks with the opposition on appointing a caretaker administration were complete.
The negotiations are aimed at ending months of political crisis in Tunisia.
The prime minister said his moderate Islamist-led government was committed to the “principle of relinquishing power in line with the different phases envisaged in the roadmap”.
“We will not submit to anyone except the interests of the country,” he said.
His address came after thousands of anti-government protesters marched through the capital, Tunis, calling for the government to go.
The political crisis was triggered by the assassination of two prominent opposition politicians earlier this year.
The deadlock has threatened to disrupt a democratic transition that began after Tunisians threw out their decades-old authoritarian government at the beginning of the 2011 uprisings, widely referred to as the Arab Spring.
Earlier this month, the governing Ennahda party agreed to step aside in favour of a caretaker government, which would run the country until fresh elections are held.
Ennahda and the opposition now have three weeks to appoint the interim cabinet. They also have one month to adopt a new constitution, electoral laws and set an election date.
Militant groups
Since the 2011 revolt, Tunisia has seen a rise in attacks by militants.
The president paid his respects to the “souls of the martyrs who were martyred today” in a speech broadcast live on national TV.
Members of the National Guard had surrounded a building in the village of Sidi Ali Bououn, following a tip-off that a suspicious group was hiding there, officials said.
A fierce gun battle ensued during which both security forces and militants were killed.
The president said the militants were responding “to the painful blow” on 17 October, when security forces killed at least nine suspected Islamist militants who the authorities said had carried out a deadly attack on a police patrol.
At least three other suspects were arrested in the operation in the Mount Taouyer area, about 70km (44 miles) west of Tunis.
The interior ministry blamed militants belonging to the Salafist Ansar al-Sharia group, who were linked to the murders of prominent left-wing figure Chokri Belaid in February and opposition politician Mohammed Brahmi in July.
Their deaths triggered mass protests against the government.
Ennahda condemned the killings but the opposition accused it of failing to rein in radical Islamists – charges it strongly denies.
Several other militant groups – including al-Qaeda in the Islamic Maghreb – also operate in the region.