By Lamine Chikhi

ALGIERS (Reuters) - Algerian forces have cleared out Islamic State-affiliated militants from the mountains east of Algiers, two years after they kidnapped and beheaded a French tourist in the former al Qaeda stronghold, senior security sources said.

Algeria, emerging from a 1990s war with armed Islamists, has been carrying out operations to flush out remnants of militants from Jund al-Khilafa, or "Soldiers of the Caliphate", who had declared themselves allied with Islamic State.

Bombings and attacks are rarer in Algeria since it ended its decade-long war, but al Qaeda in the Islamic Maghreb is still active and a small group of rival militants tied to Islamic State also began operating east of the capital.

Algeria's clearing out Islamic State allies comes as the group battles to hold its North Africa base in the Libyan city of Sirte. Tunisian militants with Islamic State in the Libyan city of Sabratha were hit by a U.S. air strike in February.

Since Frenchman Herve Gourdel was killed in September 2014 in Algeria, troops have swept through the Kabilye region, a mountainous and heavily forested area once known as part of the "Triangle of Death" during Algeria's bloody 1990s war.

"The group has been dismantled, most of its commanders were killed or arrested. It is over," one senior security source told Reuters, asking his name not be used because he was not authorized to speak to media.

Mopping up Islamic State in the north will allow Algeria's army to focus on southern borders with Libya, Mali and Niger where fleeing militants may try to slip across its frontiers, the source familiar with the operations said.

A second security source said Jund al-Khilafa has been militarily defeated over the past few months in regions including Bouira, Boumerdes and Tizi Ouzou, all the east of the capital.

Most of its commanders had been killed or arrested and its structure has been dismantled, the source said.

"Most of those killed or arrested in the northern regions of Algeria, including Tizi Ouzou, Boumerdes and Bouira belonged to Jund Al-Khilafa," the source said.

While security forces pursue Jund al-Khilafa, Al Qaeda in the Islamic Maghreb (AQIM) has been little visible in the area east of Algiers in the past two years, leading to questions whether AQIM commander Abdelmalek Droudkel fled the region usually considered his base of operations.

FORCES "CLEARING THE REGION"

Algerian forces killed 157 armed Islamists in 2015, and 99 were killed and 50 arrested in the first half of 2016, according to a defense ministry release which did not identify the groups to which those militants belonged.

The first leader of Jund al-Khilafa was Abdelmalek Gouri who was killed six months after the kidnapping of Gourdel. Gouri was a senior Algerian militant and later a fighter with Al Qaeda in Islamic Maghreb.

"We are now in the second phase that includes clearing the region, de-mining, opening roads so life can come back to normal," another senior security source told Reuters.

A resident near Tigzirt said people were returning to the area and construction was increasing as security had improved dramatically.

"Although Algeria may not have defeated the Islamic State entirely, even the Islamic State is not claiming to have even a covert presence in Algeria," said Geoff Porter, with North Africa Risk Consulting. "AQIM remains the main threat in the country and even then it is hugely reduced."

Militants can still strike. In 2013, fighters allied to veteran jihadist Mokhtar Belmokhtar attacked the In Amenas gas plant, and 40 oil workers were killed in the attack and the siege that followed.

At least nine Algerian soldiers were killed when Islamist militants ambushed their patrol west of Algiers last year, and rockets were fired at another gas plant in the Sahara operated by BP and Statoil though no damage was caused.

(Editing by Patrick Markey and Dominic Evans)