Cairo: Egypt has referred 12 men to military trial for alleged involvement in a cell behind a narrowly averted attack on tourists at a pharaonic temple in June, prosecutors said on Thursday.

The assailants had been recruited by Daesh’s Egyptian affiliate, along with two “foreigners” who were killed in the incident at the Karnak temple in Luxor, the prosecution said in a statement.

Eight of the suspects had been arrested and four were still on the run, said a prosecution official. Their nationalities were not immediately clear.

The June 10 attack was foiled by a suspicious taxi driver and police.

One of the assailants blew himself up and police shot dead another before they could attack any tourists.

A third, an Egyptian, was mistakenly wounded by a stray shot from another militant and arrested, the prosecution said.

Militants have carried out dozens of attacks in Egypt since the army overthrew Islamist president Mohammad Mursi in 2013 and cracked down on his supporters.