Militants with explosives battled Egyptian security forces outside the ancient Karnak temple in Luxor on Wednesday, striking one of Egypt’s most famous tourist sites and raising fears over the potentially expanding reach of the country’s Islamist insurgency.

Four Egyptians were injured in the attack, which unfolded near the temple complex after security forces opened fire on three militants, media reports said.

One attacker detonated his explosives just outside the temple — built during the age of the pharaohs — while another was injured and a third killed, Egypt’s Interior Ministry said.

There was no immediate assertion of responsibility. But the violence marked a significant escalation in attacks against the Egyptian government and the country’s vital tourism industry.

In response to the Luxor attack, Egyptian President Abdel Fatah al-Sissi ordered beefed-up security at key sites — including antiquities — across the country, according to the state-run MENA news agency.

Militants spurred by the military’s overthrow of the Muslim Brotherhood two years ago have waged a low-level insurgency since then. Since 2013, hundreds of soldiers and police officers have been killed by roadside bomb blasts and in drive-by shootings. Car bombs have detonated outside ­security buildings in several Egyptian provinces.

But the militants have largely avoided direct attacks on foreign visitors or tourist sites, saying that their fight is with the Egyptian state.

Tourism was a major driver of Egypt’s economy before its Arab Spring uprising in 2011. But years of turmoil and street protests have sharply cut into tourist arrivals. Authorities have tried to revive the country’s image as a tourist destination but have faced setbacks.

In early 2014, a suicide bomber detonated explosives on a bus carrying foreign tourists in Taba, a popular beach and diving center on the Sinai Peninsula near the Israeli border. The Sinai-based militant group Ansar Bayt al-Maqdis, which has since pledged allegiance to the Islamic State, asserted responsibility for that attack.

On June 3, two gunmen on a motorcycle killed two policemen near the famed Giza pyramids outside Cairo.

But attacks in Egypt’s far south, where Luxor is located, have been rare in recent years.

There is no indication that hard-line jihadists are operating in the area, security analysts said Wednesday. Luxor is 300 miles south of Cairo and about 600 miles from the militants’ strongholds in Sinai.

The attack on Wednesday, although foiled by Egyptian police, was reminiscent of the 1997 massacre of more than 60 people at the nearby Hatshepsut temple — the deadliest terrorist attack in Egypt’s history.

Around the region, security forces have been on heightened alert at tourist sites since gunmen in March stormed the popular Bardo Museum in Tunis, killing 21 people, mostly visitors from Europe. The Islamic State asserted responsibility for the siege.

On Wednesday, the governor of Luxor, Mohammed Sayed Badr, told the Associated Press that the attackers tried to “break into the temple of Karnak,” part of a complex started 4,000 years ago and built over many centuries.

“They didn’t make it in,” he said, describing a shootout between security forces and the attackers in the parking area outside the temple, one of the most heavily visited tourist sites in Egypt. Badr said a bomb-rigged belt worn by one of the attackers exploded as he ran.

But MENA, citing the Interior Ministry, said at least one attacker breached the site’s barricades and detonated explosives. Egypt’s Health Ministry said at least four people were injured, including two Egyptian shop owners and two policemen.

The Luxor governor said no tourists were hurt. It was unclear how many visitors were at the site at the time of the clash.

But although the attack failed, it rattled locals whose livelihoods depend on tourism. In 2010, just before the revolt, tourism made up 14 percent of Egypt’s gross domestic product, according to the Egyptian Tourism Federation.

“I am worried that there will be rumors about people dying, and that will scare the tourists away,” said Ahmed Mohamed, an Egyptian tour guide with Abu Simbel Tours. “Things have been stable in Luxor for a long time.”

Read more:

Gunmen shatter peace near pyramids

Gallery: A post-revolution trip through Egypt

Tunisia’s Bardo museum, attacked by terrorists, is home to amazing Roman treasures