More than a thousand people have demonstrated in the northwestern Tunisian town of Jendouba against the weekend killings of three policemen and a civilian.

Protesters expressed their support for the security forces on Monday, stopping outside two police posts, chanting the national anthem and shouting: "We are with you!", "Tunisia is free, terrorism out".

As the four victims were buried, Mehdi Jomaa, the country's new prime minister, said the state would not be undermined by "terrorism".

"These terrorists had a plan to undermine the state. Because they could not do so, now they want to undermine the confidence that has returned in the citizens," he said.

Live Box 201321413588877946

State news agency TAP said on Sunday that four armed men dressed as Tunisian security officials killed the four and wounded two police and a border agent just after midnight. Police later claimed there were three Tunisians and two Algerians among the attackers.

A statement from Tunisia's Interior Ministry said early on Sunday that fighters shot at a vehicle driving along a road near Jendouba, killing a prison official, a civilian and wounding two others, according to AP news agency. 

The group then ambushed a patrol sent to investigate the attack, killing two members of the National Guard and wounding two others.

Tunisia's security forces have been battling fighters from the banned movement Ansar al-Sharia, whose leader has declared allegiance to al-Qaeda's North Africa wing.

The faction was one of the most combative groups to emerge after Tunisia's 2011 uprising against long-time ruler Zine el-Abidine Ben Ali, whose government often jailed opposition leaders.

Tunisia has continued its transition to democracy since the revolt, with a new constitution and elections scheduled for this year.

Earlier this month, police killed seven armed with suicide bomb vests and explosives in a raid north of the capital Tunis.

Ansar al-Sharia was blamed for storming the US embassy in Tunis in 2012.

Source: Agencies