Mexico is calling for an "exhaustive" investigation into the mistaken killing of several of its citizens by Egyptian security forces. (Reuters)

An Egyptian helicopter strike on desert trekkers misidentified as militants has highlighted the government’s inability to contain Islamist insurgents whose geographic reach appears to have expanded in recent months.

The attack, which killed 12 foreigners and Egyptians in Egypt’s Western Desert on Sunday, also shows the crude tactics security forces have used to combat jihadists elsewhere in the country. Security forces have for years battled militants concentrated in the restive Sinai Peninsula east of Cairo, using tanks, fighter jets and helicopter gunships to attack militant strongholds, the military says. But recently, the jihadists have launched violent attacks across the country, including in the Western Desert.

That desert — an expanse of black-and-white rock formations several hundred miles southwest of Cairo — has long served as a smuggling hub because of its proximity to a lawless Libya. On Sunday, militants claiming links to the Islamic State posted images of what they said were jihadists battling the Egyptian military in the desert, where the state’s authority is weak.

It was during those clashes, a local resident said, that security forces called in airstrikes that would tear through the convoy of tourists, killing 12 as they sat down to eat. At least two of those killed were Mexican nationals, Mexico’s Foreign Ministry said. Egypt’s flagship state-run newspaper quoted a judicial official as saying that seven Mexican tourists had been killed. That death toll could not be confirmed.

Mexican officials, including President Enrique Peña Nieto, condemned the attack and called on Egypt to conduct an “exhaustive investigation.” The country’s foreign secretary, Claudia Ruiz Massieu, confirmed to reporters Monday in Mexico City that Egyptian aircraft had fired on the tourists during their safari.

The tourists “suffered an aerial attack with bombs launched from an airplane and helicopters,” Ruiz Massieu said, in the clearest account of the attack.

Some analysts believe the jihadists’ fresh links to the Islamic State, which holds wide swaths of territory in Iraq and Syria, have emboldened fighters in Egypt. In June, militants assassinated Egypt’s chief prosecutor in a car bomb attack in Cairo that marked the first high-profile political slaying in Egypt since the 1990s.

Several days later, hundreds of militants launched an assault on the Sinai town of Sheikh Zuweid, killing 16 Egyptian soldiers in an hours-long gun battle. Then, in July, masked gunmen claiming to belong to the Islamic State beheaded a Croatian oil industry worker, Tomislav Salopek, after he was abducted off a highway near Cairo.

In the Western Desert, militants killed more than 20 Egyptian soldiers in a sophisticated attack on an army checkpoint near the Farafra oasis, 300 miles from Cairo, in July 2014. Last month, an Egyptian military helicopter crashed while chasing militants near the Siwa oasis, also in the Western Desert. An army spokesman said the aircraft crashed as a result of technical failure.

According to Mokhtar Awad, researcher and expert on Egyptian militant groups at the Center for American Progress, the Western Desert is “more of a transit zone, a hub for smuggling weapons,” than an outright battlefield. But “there have been some troubling developments” in the area, he said.

On Monday, Egyptian officials blamed the tour group for entering what they called a “restricted area,” with the Tourism Ministry’s spokeswoman vowing to “punish” the tour operators for allowing the convoy to drift into a military zone.

“They didn’t know there was a battle going on,” Mohammed ­Nofal, a resident of the nearby town of Bahariya, said of the tourist convoy. “But these areas of the desert are dangerous.”

The travel company, Windows of Egypt, fired back, insisting that it had obtained the necessary permits to take the group into the desert — and that the vehicles had not entered a restricted zone.

The desert and its large oases have long been popular destinations for tourists, even as the industry was crippled by political turmoil in the wake of the Arab Spring. And the tour company’s Web site advertises a three-day trip to the Western Desert, including food, accommodation, and “all necessary permits.”

“The fact is that Egypt’s military really only controls a fraction of the country’s vast territory,” Daniel Nisman, a security analyst at the political risk firm the Levantine Group, said on Twitter. “It is overstretched and underequipped.”

Cunningham reported from Baghdad, and Partlow reported from Mexico City. Heba Habib in Italy contributed to this report.