Two suicide bombers killed outside the building where leaders voted to support the UN-backed plan.

Somali leaders have approved a new constitution for the struggling country, shortly after two bombers blew themselves up outside the building.

The vote on Wednesday with 621 for, 13 against, and 11 abstentions came after two suicide bombers tried to attack the Mogadishu meeting.

“We are very happy today that you … responsibly completed the procedure by voting for the constitution,” Prime Minister Abdiweli Mohamed Ali told the 825 strong assembly after it approved the draft by a landslide 96 per cent.

A police officer told the AP news agency that security forces shot the two bombers at the gate to the meeting area.

“The two bombers were killed and one Somali soldier was wounded”, Abdi Yassin said.

No group immediately claimed responsibility for the attack, which follows a string of explosions, including roadside bombs and grenades, that have rocked the Somali capital.

The special assembly, chosen by traditional elders in a UN-backed process took eight days to debate and vote on the new constitution for war-torn Somalia, as the government approaches the end of its mandate on August 20.

The provisional constitution signed applies immediately, but it must be finally ratified by a national referendum.

Al Jazeera’s Peter Greste reporting from Nairobi said: “What we are seeing is a document which will pave way for a transitional government.”

Speaking with Al Jazeera from the capital Mogadishu, Doctor Augustine Mahiga, said that the next step in the process would be to select the members of the new parliament.

“Today’s step was a major [one] in the Somali peace process, because it completed one of the major steps in completing the transition,” Mahiga, the UN’s top representative to Somalia, said. “That is, the adoption of a provisional constitution.”

“Today’s bombing came as a foiled attempt to disrupt this, as part of the asymmetrical warfare the insurgents are trying to wage with limited success,” he said.

Sharia law

The constitution, some eight years in the making, makes it clear that Islamic law is the basis for Somalia’s legal foundation. No religion other than Islam can be propagated in the country and all laws must be compliant with Sharia law.

The constitution protects the right to an abortion to save the life of the mother and bans the circumcision of girls, a common practice in Somalia that opponents call female genital mutilation.

The UN hopes to transition the country to a more representative form of government, but nationwide or even regional elections appear to be years away.

Still, the top UN representative to Somalia, Augustine Mahiga, said that a new, more representative era for Somalia is about to start after the vote of Somali leaders, or elders.

“Through their good work, the elders have proven their reputation as the custodians of the Somali nationhood and demonstrated their respect for a fair and legitimate process,” he said.

Somalia has been without a stable central government since the ouster of former president Siad Barre in 1991.

Mogadishu has seen a series of such attacks since al-Shabab abandoned fixed positions there last year and switched to guerilla tactics against the government, propped up by a 17,000-strong African Union force.

The al-Shabab forces face increasing pressure from pro-government forces and regional armies, having lost a series of key towns and strategic bases in recent months.

However, experts warn they are far from defeated and remain a major threat.