At least two Mexicans were killed, Mexico’s foreign ministry said in a statement.

A joint force from the Egyptian police and military was chasing militants in the vast western desert, which borders Libya, when it inadvertently opened fire on the convoy.

The convoy was made up of four four-wheel drive vehicles, the Egyptian interior ministry said, and there will be an investigation into how, and why, the tourists entered an off-limits area.

On his Twitter account, Mexican president Enrique Pena Nieto condemned the attack, describing it as a tragic incident and demanding a full investigation.

“Mexico condemns these deeds against our citizens and has demanded an exhaustive investigation of what has occurred,” he wrote.

Egypt’s tourism ministry spokesman told state news agency MENA that the convoy was at an off-limits site and was using unlicenced cars. The convoy was taking part in an unapproved safari, he said.

Mexican ambassador Jorge Alvarez met with five Mexicans who were in stable condition in hospital, Mexico’s foreign ministry said.

The Mexican ministry said an “undetermined” number of its country’s nationals had been attacked and that it was identifying the two who had been killed.

Egypt is battling an insurgency that gained pace after the military ousted Islamist president, Mohamed Morsi, of the Muslim Brotherhood, in mid-2013, after mass protests against his rule.

The insurgency, mounted by Islamic State’s Egyptian affiliate, has killed hundreds of soldiers and police and has started to attack Western targets.

Earlier on Sunday, Islamic State released a statement, carried by its supporters on Twitter, saying it had repelled an attack by the Egyptian military in the western desert.

While the insurgency has been largely based in the Sinai Peninsula, attacks have taken place in Cairo and other cities.

In August, an Egyptian military aircraft crashed in the western desert near the Libyan border while on a mission against Islamist militants, killing four people.

Security officials say militants operating from Libya to the west of Egypt have been trying to forge ties with Islamists in the Sinai, on the east side of the country.

Egyptian jets bombed Islamic State targets in Libya in February, a day after the group there released a video showing the beheading of 21 Egyptian Christians, drawing Cairo directly into factional conflict across its border.