Algerian troops have ambushed and killed at least 21 fighters allied to the Islamic State of Iraq and Levant (ISIL) as they held a meeting east of the capital in one of country's largest military operations in recent years, the defence ministry and security sources have said.

An official said the fighters were meeting in a forest on Tuesday to plan an attack in the capital Algiers.

The official said that two others were captured in the assault in the Boukram forest in Boumerdes, about 20km from Algiers.

A dozen Kalashnikovs, three rocket launchers and dozens of homemade bombs were said to have been recovered.

"This is a major counterterrorism operation, the largest in terms of militants killed in years," a security source told the Reuters news agency.

The state news agency APS, quoting a defence ministry statement, said the army was still pursuing other members of the group, but did not give further details or mention the affiliation of the fighters involved.

However, security sources said the strike was against members of the Caliphate Soldiers, an al-Qaeda splinter faction that had declared allegiance to ISIL who have taken over large swathes of Iraq and Syria.

The Caliphate Soldiers in September last year kidnapped and killed a French tourist in the mountains east of Algiers.

Since then, security forces have carried out increased operations in the region.

Following Algeria's decade-long 1990s war with fighters wishing to introduce Islamic law, the country has become a partner in the Western campaign against insurgencies across North Africa, especially with turmoil in parts of northern Mali and Libya.

Fighters allied with both al-Qaeda in the Islamic Maghreb and ISIL operate in Algeria, mostly in mountainous northern areas.

Source: Agencies