MOGADISHU, Somalia -- Somali leaders voted overwhelmingly on Wednesday to adopt a new constitution that contains new individual rights and sets the country on a course for a more powerful and representative government. The vote came after two thunderous blasts at the gates of the meeting site from a failed suicide attack.

The 825 Somali leaders who debated the constitution for a week approved the document with 621 for, 13 against and 11 abstentions. 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 Shariah -- Islamic 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.

"Today, Somalia has put its feet onto a democratic and peaceful path. The new constitution will heal Somalia from war trauma and put it onto a more peaceful life," said Abshir Abdi, an assembly attendant.

The U.N. 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 U.N. representative to Somalia, Augustine Mahiga, said that a new, more representative era for Somalia is about to start after the vote by 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.

The delegates voted about two hours after two suicide bombers tried to attack the Mogadishu meeting. A police officer said security forces shot the two bombers at the gate to the meeting area. The two bombers were killed and one Somali soldier was wounded, said Abdi Yassin, a police officer.

The explosions are a reminder that even as Somalia continues down a slow path of re-establishing a functioning government after two decades of near anarchy in this East African nation, al-Shabab militants who were pushed out of the capital last year can still infiltrate Mogadishu and wreak havoc.

Somali Prime Minister Abdiweli Mohamed Ali said the vote by the National Constituent Assembly means that Somalia has ended its period of transitional government. The U.N. mandate for Somalia's current government -- the Transitional Federal Government, or TFG -- expires on Aug. 20. Somali leaders were tasked with voting on the constitution, voting in a new 275-member parliament, and electing a president before then.

Security has improved markedly in Mogadishu over the last year, leading to a general revival of the seaside capital. But militants of the hardline Islamist group al-Shabab still infiltrate the city and carry out suicide attacks, particularly at high-profile events. An offensive by African Union and Somali forces pushed al-Shabab fighters out of Mogadishu on Aug. 6, 2011.

The new constitution offers more rights and protections to women and children than those groups have had before. The International Development Law Organization, a group that offers legal expertise and resources to governments and civil society groups, said Somalia's constitution guarantees more fundamental rights than those of the U.S. and Italy.

"For the first time in 20 years we have peacefully held such a remarkable assembly in our country. Furthermore this constitution boosted the morale of the women, whose rights were deprived by the previous constitution and governments," said Halimo Dahir, a female member of the assembly.

The English translation of the Somali language constitution is 88 pages long. It was drafted by Somalis, international law experts and members of the Somalia diaspora in the U.S., Canada, Britain and Australia. That international expertise and the overseas experience of the Somali expatriates may explain the draft's numerous individual rights.

No marriage is legal without the consent of both the man and the woman, it says. No child may perform work that is not suitable for a child's age, though many children in the country do work. Each child is to be protected from armed conflict, it says. Somalia has a history of child soldiers on both the government and insurgent side.

"All citizens, regardless of sex, religion, social or economic status, political opinion, clan, disability, occupation, birth or dialect shall have equal rights and duties before the law," it says. Circumcision of girls is "a cruel and degrading customary practice, and is tantamount to torture. The circumcision of girls is prohibited."

The constitution says abortion is contrary to Shariah law and is prohibited "except in cases of necessity, especially to save the life of the mother."

Some of these provisions may be hard for the government to enforce. In a country where basic needs like food are not always met, the constitution says that every person has the right to clean, potable water. Every person has the right to health care, even if they can't pay for it, the document says, another difficult-to-fulfil promise.

The country's former constitution was the Transitional Federal Charter, written in 2004. Meant only as a temporary charter, it contained fewer rights than those spelled out in the new constitution. Somalia has not had a powerful central government since 1991, when the president was killed and the country collapsed into chaos. The international community is working to create a government respected by the people that can provide goods and services in and outside the capital.

But Mahiga warned of vote-buying and general corruption taking place in the scramble to name a new parliament.

"There have been disturbing reports of undue influence from aspiring politicians in current and former positions. This influence takes many forms including exchange and demands for favours, bribery and intimidation. We should not allow parliamentary seats to become commodities for sale or items for auction to the highest bidders at a time when we are seeking to reclaim the true stature of a dignified and respected Somali nation," he said.

A scathing report written for the U.N. Security Council last month found that systematic misappropriation, embezzlement and outright theft of taxpayer funds have become a system of governance in Somalia. The report, written by the U.N. Monitoring Group on Somalia and Eritrea, quoted a senior government official as saying that nothing gets done in the Somali government without someone asking the question "What's in it for me?"