MOGADISHU, Somalia (AP) — Two bombs exploded inside a small mosque in Mogadishu's main market on Saturday, killing at least 30 people in the first Iraq-style bombing inside a house of worship in Somalia, officials said.

The blasts in the Bakara market went off while people were sitting inside the Abdala Shideye mosque waiting for noon prayers. The bombings highlight the increasingly violent path Somali militants are taking following an influx of insurgents into the country from the Afghanistan conflict, fighters who are now training Somali militants.

The targeted mosque is tiny — only about 25 square yards (meters) — and sits in a crowded market among electronic shops. Rugs that line the mosque floor were set on fire, and streaks of blood and black smoke charred the walls.

"It was very horrific. The blood was every where. Human flesh cut into pieces scattered every where in the mosque. I could hardly stay there," said Abdulahi Nuur, who attended to the dead and wounded.

Most of the victims were worshippers.

Ali Muse, the head of Mogadishu's ambulance service, said at least 30 people were killed and 70 wounded. Abdullahi Haji Ilmi, a witness, said he counted 32 bodies.

Somalia's top two insurgent groups — al-Shabab and Hizbul Islam — have previously targeted each other's leaders, and Saturday's attack could have been a retaliatory assassination attempt against al-Shabab.

A high-ranking member of al-Shabab was said to be inside the mosque. It was not immediately known whether Fuad Mohamed Qalaf survived the bombings. Qalaf is among 11 people whose assets were recently frozen by the United State for involvement in terrorism.

"Sheikh Fuad used to teach religious lessons at the mosque every Saturday. He was there when the blasts went off. The whole area was cordoned of by scores of al-Shabab militants. Nobody could get inside," said another businessman, Farhan Alin.

Witnesses said two remote-controlled bombs were detonated, including one that was placed near the front entrance, where worshippers put their shoes before going inside. A second bomb was said to have been at the front of the small mosque, where the imam would stand.

An al-Shabab spokesman, Sheik Ali Mohamud Rage, blamed the attack on the work of "foreign security companies" whose aim, he said, was to massacre Muslims. Rage offered no proof for his allegation.

No one immediately claimed responsibility for the attack, the first such bombing of a mosque in Somalia. A bombing took place outside a mosque in Bakara earlier in the week, killing two people.

Bakara market is the country's main market, and despite tensions in the country, it is bustling with business. The area is controlled by al-Shabab and Hizbul Islam.

The U.N.-backed Somali government views the market as rebel stronghold. Over the last three years the market has seen near-daily shelling between militants and African Union and Somali soldiers. Hundreds of people have been killed in the violence.

Islamic insurgents control much of Mogadishu and have been trying to topple the fragile government for three years. Somalia has not had an effective government for nearly 20 years.