Cairo: The Islamic State of Iraq and the Levant (Isil), fighting to redraw the map of the Middle East, has been coaching Egypt’s most dangerous militant group, complicating efforts to stabilise the biggest Arab nation.

Confirmation that Isil, currently the most successful of the region’s Islamist militant groups, is extending its influence to Egypt will sound alarm bells in Cairo, where the authorities are already facing a security challenge from home-grown militants.

A senior commander from the Sinai-based Ansar Bayt Al Maqdis, which has killed hundreds of members of the Egyptian security forces over the last year, said Isil has provided instructions on how to operate more effectively.

“They teach us how to carry out operations. We communicate through the internet,” the commander, who asked to remain anonymous, told Reuters.

“They don’t give us weapons or fighters. But they teach us how to create secret cells, consisting of five people. Only one person has contact with other cells.” Militant groups and the Egyptian state are old foes. Some of Al Qaida’s most notorious commanders, including its current leader Ayman Al Zawahri, are Egyptian.

One Egyptian president after another has crushed militant groups but they have always resurfaced.

The success of Isil in seizing large parts of Syria and Iraq has raised concerns in Egypt, where authorities are battling Ansar as well as militants who have capitalised on the chaos in post-Gaddafi Libya to set up over the border.

Isil became the first Islamist militant group to defeat an Arab army in a major operation after steamrolling through northern Iraq in June almost unopposed by the Iraqi military.

Unlike Al Qaida, which specialises in hit and run operations and suicide bombings, Isil acts like an army, seizing and holding territory, a new kind of challenge for Western-backed Arab states.

Army offensives have squeezed Ansar, forcing its members to flee to other parts of Egypt, the commander said. But it still poses a security threat.

President Abdul Fattah Al Sissi has expressed concerns about militants over the Libyan frontier. Security officials say these groups are inspired by Isil, an offshoot of Al Qaida notorious for beheadings and mass executions, most recently of American journalists James Foley and Steven Sotloff.

Al Sissi, who as army chief toppled Islamist President Mohammad Mursi last year after mass protests against his rule and then cracked down on his Muslim Brotherhood, has restored some political stability.

But militant groups still present a major challenge.

Security officials say thousands of Egyptian militants have joined Isil’s jihad in Iraq and Syria and authorities are concerned they could return home to fight the government.

That would pile pressure on Egyptian security forces who have failed to end a campaign of bombings and shootings which killed hundreds of soldiers and police since Mursi’s fall.

Egyptian security officials say leaders of Isil and Ansar have established contacts. Meanwhile, militants based in Libya have also forged ties with Ansar, creating a complex web.

Ansar recently said it had beheaded four Egyptians, accusing them of providing the Israeli regime with intelligence for an air strike that killed three of its fighters.

Four headless corpses were found in the Sinai Peninsula. It was the first time that any decapitations had been made public in Egypt, a strategic Mohammad ally which has a peace treaty with the Israeli regime and controls the Suez Canal, a key global shipping route.

In a video on Twitter, armed men in black masks stood over the kneeling captives as one of the militants read out a statement. Minutes later, the four men had their heads cut off.

The Ansar commander, who said his group had contacted Isil for advice, described the beheadings as a clear message that anyone cooperating with the group’s enemies would face a similar fate. “The beheadings had a purpose,” he said.

The violence suggested a new level of radicalism in Egypt, where security crackdowns, political violence and street protests have hammered the economy since the “Arab Spring” uprising ousted President Husni Mubarak in 2011.

“Ansar and Isil definitely have ties but there are no Isil members in Egypt,” said a security official.

“There is definitely coordination between Ansar, the militants in Libya and Isil leaders.” The security official said Egyptian authorities have handed airport officials lists of Egyptians who went abroad to wage jihad.

“There are some people who we know are coming back to carry out attacks so we arrest them. The same goes for others who come back to visit their families,” he said.

“There is a third type who comes back to recruit. We just watch him until the time is right to move in.” The movement of Ansar militants from the Sinai to towns and cities outside the peninsula could make it more difficult for intelligence agencies to track the group.

“We have trouble working in Sinai. It’s easier elsewhere,” said the Ansar commander, adding that fighters were benefiting from advice provided by Isil.

“They are teaching us how to attack security forces, the element of surprise,” he said. “They told us to plant bombs then wait 12 hours so that the man planting the device has enough time to escape from the town he is in.” The commander said bombings not carried out by Ansar suggested new militant groups had appeared in Egypt, adding that there is a flow of militants both ways across the Libyan border.

“There are others operating in Egypt. We don’t know anything about them,” he said. “We have individuals who went to Libya. We lost contact.” Asked about pressure from Egypt’s military, one of the biggest in the world, the commander said security offensives had created new enemies for the state.

“Every time one of us is killed, two or three others join. Usually relatives of those who are killed.”