Iraqi leaders overcame ethnic and religious divisions, under the watchful eye of US officials, to agree on a temporary constitution for the war-torn country that will be signed mid-week.
The basic law text negotiated the thorny issues of the role of Islam, Kurdish self-rule and the representation of women that had forced the US-picked interim Governing Council to miss a Saturday deadline for completion.
"We just broke out (of the meeting). The Fundamental Law has been concluded," a jubilant Intifah Qanbar, spokesman for Ahmed Chalabi representing Iraq's Shiite Muslim majority, told AFP just before 4:30 am (0130 GMT) on Monday.
Council member Mahmud Othman, a Kurd, was also pleased with the outcome.
"The discussions are finished and there is no longer any problem. It is a major achievement," he said, adding that the text would be signed Wednesday after the end of the Shiite religious mourning period of Ashura.
The 25 council members, with guidance from US overseer Paul Bremer and British representative Jeremy Greenstock, worked day and night to finalise the law, aimed at seeing Iraq through a period of transition ahead of elections and into next year.
The temporary constitution -- made up of about 60 articles -- will enshrine a bill of rights, protecting such values as freedom of speech, freedom of religion, and freedom of assembly, when it takes effect at the end of June.
"It is an incredibly comprehensive bill of rights," said an official of the US-led military coalition, which ousted dictator Saddam Hussein's secular regime last April.
"This is a bill of rights for a society that has been tortured and devastated for 35 years by a totalitarian system that we believe shares the company of the Nazis, the Third Reich, and the Stalinist regime."
The document, which allows for civilian control of the military, is an important step in clearing the way for a June 30 transfer of sovereignty from the coalition to an Iraqi interim authority.
It sets a timeline for direct elections before the end of January 2005 and lays out the framework of the "transitional national assembly" which will then draft a permanent constitution.
Iraq's Christian community were happy with the new law, but an official from the Turkmen ethnic group, the country's third largest, was less than pleased.
"We're satisfied. We have obtained what we asked for. Article four preserves the political, administrative and cultural rights of the Assyrians and Turkmen," Yonnadam Yussef Kanna, a Christian member of the council, told AFP.
"We consider this law a failure not a success," said Saadeddin Mohammad Arkaj, deputy of the Iraqi Turkmen Front (FIT) party. "We refuse to be classed a minority because we are one of Iraq's main ethnic components."
The discussions have forced contentious issues into the spotlight such as whether Islam should be the basis for the constitution, a priority for many ordinary Iraqis to give the document legitimacy in their eyes.
Qanbar said: "Islam will be a source and there shall not be any law against Islam. It will preserve the rights of the individual."
The use of the word "source" was probably a compromise for Bremer, who had threatened to use his veto if the law was based entirely on Islam and the rights of minorities were not protected.
On the dispute over setting up a federal state, Qanbar suggested the details would be finalised once a new transitional government is put in place.
"Kurdistan will continue to be federal, the rest of Iraq will be given the right to prepare to form federal states. The elected government will decide on the status of federalism and deal with this strategic situation," he said.
The Kurdish north of the country has enjoyed autonomy since 1991, in defiance of Saddam, and the Kurds had demanded that they be allowed to maintain their prerogatives.
On the question of women, the law specifies a target of 25-percent representation for women in Iraq's first directly-elected assembly.
The goal falls short of the 40 percent demanded by women and some secular council members, but it still offers women far stronger assurances than they are granted in other Middle East countries.