LUXOR, Egypt -- Militants tried to attack the ancient temple of Karnak in southern Egypt on Wednesday, with a suicide bomber blowing himself up and two gunmen battling police. No sightseers were hurt in the thwarted assault, but it suggested that Islamic extremists are shifting targets from security forces to the country's vital tourism industry.

The violence left the bomber and one gunman dead, the other wounded and arrested, and four other people wounded. The temple was not damaged.

The attackers carried guns in backpacks, and one wore a belt of explosives. They rode in a taxi through a police checkpoint to a parking lot and sat at a cafe and ordered lemonades, witnesses told The Associated Press. The taxi driver, suspicious after they refused his offer to help with the packs, alerted police.

When a policeman approached, the bomber tried to hug him, but the policeman wrestled away. Seconds later, he detonated the explosives, and the others pulled automatic weapons from their bags and opened fire wildly, sending a small group of European tourists running for cover, the witnesses said.

The attack followed one this month outside the famed Giza Pyramids in which gunmen killed two policemen. The violence points to a change in tactics by Islamic militants against the government of President Abdel-Fattah el-Sissi. For two years, attacks have been centred in the Sinai Peninsula, mostly by a group that has sworn allegiance to the Islamic State group and largely focused on retaliation against police and soldiers.

A campaign against tourism, one of the main sources of foreign revenue, could deal a blow to el-Sissi's promises to repair Egypt's economy.

Tourism has just started to show signs of recovery after plunging in the turmoil since the 2011 uprising that ousted autocrat Hosni Mubarak. The first five months of this year saw tourism revenues up 9 per cent from the same period last year, Tourism Minister Khaled Ramy said.

Ramy said he expects the slow recovery to continue despite the attack, and he underscored how police had thwarted it.

"Security forces were there. It's a very important message to everyone," he told the AP on a flight from Cairo to Luxor.

Mohammed Sayed Badr, the governor of Luxor province, said the attack was "an attempt to break into the temple of Karnak."

"They didn't make it in," he said.

But witnesses noted it was civilian bystanders who alerted police to the threat.

Karnak, one of Egypt's biggest attractions, is a giant complex of temples, statues, obelisks and columns built by pharaonic dynasties alongside the Nile. The oldest sections date back nearly 4,000 years.

Access to the site is through a gate and a roadblock, leading to a parking lot and visitors' centre hundreds of yards from the ancient structure, which is reachable only on foot.

The waiter who served the men said only one spoke to him and had an accent from northern Egypt, while the others stopped talking when he approached. When they paid their bill, he said he refused to take their tip.

"They looked scary. ... One of them had really bad eyes," said the waiter, who asked to be identified only by his first name, Ikrami, for fear of problems with police for talking to the media.

Another cafe employee, Abdel-Nasser Mohammed, said the taxi driver reported his suspicions about the men to police. As the three walked away, a policeman approached them, leading to the tussle between the officer and the bomber, Mohammed said.

The bomber triggered the blast near a public restroom, and the other two opened fire. One ran toward the visitors' centre, and a policeman shot him in the head, Mohammed said.

Tourist shop owner Sheik Ahmed Abdel-Mawgoud said he been standing near the restroom only seconds before the blast.

"When the explosion happened, I ran for cover and told my friend, a tour guide, to run with the tourists with him. I screamed at him, 'Terrorism!"' he told the AP.

The exchange of fire with police lasted several minutes, witnesses said, and two policemen were among the wounded.

Only a handful of tourists and Egyptians were in the temple at the time, security officials said, speaking on condition of anonymity because they were not authorized to talk to the media.

AP video of the scene showed what was believed to be the remains of the bomber covered with a black sheet with pools of blood nearby.

The monument "is safe and unaffected and visitors continue to arrive," temple director Mohammed Abdel-Aziz told the AP. Four groups of foreigners visited after the attack.

There was no claim of responsibility, but the attack bore the hallmarks of Islamic militants who have operating in the Sinai Peninsula.

Last year, the main Sinai-based insurgent group, Ansar Beit al-Maqdis, pledged allegiance to the Islamic State group, which has destroyed archaeological landmarks in Syria and Iraq, viewing them as idolatrous.

The violence in Sinai accelerated and spread to other parts of Egypt following the 2013 military overthrow of Islamist President Mohammed Morsi. The militants say the attacks are in retaliation for a massive crackdown on Islamists in Egypt.

A senior security official said investigators are looking to see whether the Luxor attackers are Egyptians and whether it marks an expansion of the violence to southern Egypt, which was a breeding ground for the militants of the 1990s and 2000.

In the 1990s, Islamic militants targeted tourism to try to undermine the economy. The deadliest attack was in Luxor in November 1997, 58 people were killed at the 3,400-year-old Hatshepsut Temple.

The official, who spoke on condition of anonymity because he was not authorized to talk to reporters, said the new breed of militants were unknown to the authorities. But he said the latest attack was a qualitative shift in the militants' target.

The attack coincided with a major regional economic summit, hosted by el-Sissi at the Red Sea resort of Sharm el-Sheikh.

Luxor is home to some of Egypt's most famous ancient temples and pharaonic tombs, including that of King Tutankhamun. The city has been one the sites hit hardest by the sharp downturn in foreign visitors since the 2011 uprising.

Before the turmoil, tourism accounted for as much as 20 per cent of Egypt's foreign currency revenues, with as a high of 14.7 million visitors in 2010.

After the uprising, those numbers plunged to 9.6 million, and then fell lower in 2013 after Morsi's ouster. Tourists have been coming back slowly, with revenues jumping to $4 billion so far this year, compared with $1.9 billion in the same period in 2014.

Beach resorts in southern Sinai and along the Red Sea coast have drawn most of the visitors, with cultural sites like Luxor seeing only a trickle. Most tourists in the searing heat of the summer months come to Luxor only for a one-day trip from the Red Sea resort of Hurghada.

Wednesday's attack is likely to result in cancellations in bookings for Luxor, although the blow is cushioned by the fact that it is low season and most tourists stay away until October.

Three major German operators, TUI Deutschland, the Germany branch of Thomas Cook and L'TUR, said they are temporarily cancelling excursions to Luxor, but stressed that most of their customers are at Red Sea resorts or on Nile cruises.

"We have no reason to advise against travelling to Egypt at the present time, since the German Foreign Ministry hasn't changed its security guidance," said L'TUR spokesman Thomas Pluennecke. "But, as a precaution, we have stopped all excursions to Luxor. Of course we take the situation seriously."