A homemade bomb exploded in a 650-year-old bazaar packed with tourists Sunday, killing a French woman and wounding at least 21 people, most of them foreigners. Within an hour, police found a second bomb and detonated it safely. Security officials said three people were in custody. "We were serving our customers as usual, and all of a sudden there was a large sound," said Magdy Ragab, 42, a waiter at a nearby cafe. "We saw heavy gray smoke and there were people running everywhere ... Some people were injured by the stampede, not the shrapnel." An expert on Islamic extremism said the attack might have been a response to last month's IDF operation in Gaza. Tourism is one of Egypt's major sources of foreign income and has been a target in past attempts to harm the government, which is now trying to negotiate a long-term Gaza cease-fire. Sunday's attack was the first on tourists in three years. The blast hit the bustling main plaza at the Khan el-Khalili, a bazaar popular with tourists next to one of Cairo's most revered shrines, the Hussein mosque. Blood stained the stones in front of the mosque, where worshippers had been conducting evening prayers. "I was praying and there was a big boom and people started panicking and rushing out of the mosque, then police came and sealed the main door, evacuating us out of the back," said Mohammed Abdel Azim, 56. Montasser el-Zayat, a lawyer who has represented Islamic extremists, told the Arabic news channel al-Jazeera the attack may be linked to anger over the IDF offensive. "The nature of the explosion looks like an act carried out by young, inexperienced amateurs whose emotions were inflamed by the events of Gaza," said el-Zayat, who once had links with extremist groups himself. Initial reports on Sunday's attack said a pair of grenades were thrown, but a government statement said the attack involved a homemade bomb placed under a bench in the main plaza. A medic at the scene said the French woman died in the intensive care unit of the nearby Hussein hospital. The wounded included three Saudis, 13 French, a German and four Egyptians, including a child, the government statement said. The health minister announced that the injuries were comparatively minor and most of the wounded would be released from the hospital by Monday. French President Nicolas Sarkozy issued a statement expressing his condolences to the victim's family and stating his confidence that Egyptian authorities would "shed light on the circumstances of this tragedy." Egypt fought a long war with Islamist militants in the 1990s, culminating in a massacre of more than 50 tourists in Luxor in 1997. The rebels were largely defeated, and there have been few attacks since then in the Nile valley. But from 2004 to 2006, a string of bombings against resorts in the Sinai Peninsula killed 120 people, including in the Sinai's main resort of Sharm el-Sheik. Cairo's Khan el-Khalili has been targeted before as well. In April 2005, a suicide bomber killed two French citizens and an American. One of Egypt's highest religious officials, Sheik of Al-Azhar Mohammed Sayyed Tantawi, called Sunday's attack "cowardly and criminal." "Those who carried out this criminal act are traitors to their religion and country and are distorting the image of Islam, which rejects terrorism and prohibits the killing of innocents," he said.