Just a day after warning that the meeting, or loya jirga, was heading toward a humiliating failure, chairman Sibghatullah Mujaddedi announced that last-ditch diplomacy had secured a deal.
After the new draft was circulated, the 502 delegates who had gathered under a giant tent in the Afghan capital rose from their chairs, standing in silence for about 30 seconds to signal their support for the new charter.
President Hamid Karzai used a speech to try to sooth tempers after a debate that saw him and his ministers accused of trying to crush dissent with heavy handed lobbying.
The president thanked every ethnic group, pledged to learn the Uzbek language, and called for an end to tribe-based politics.
"Today we proved that we have national unity," he said. "It is a very great success ... We should respect it, we should implement it."
The charter was amended to grant official status to northern minority languages where they are most commonly spoken, an issue which had brought the meeting close to collapse.
U.N. Special Representative Lakhdar Brahimi and U.S. Ambassador Zalmay Khalilzad hailed the accord.
"It's a huge success for the people of Afghanistan," Brahimi said, although he added that there was work to do to repair the "bruises" from the ethnic debate.
"It's a good framework," Khalilzad said.
Sidiq Chakari, a Tajik delegate and spokesman for faction leader and former President Burhanuddin Rabbani, who had taken part in a boycott Thursday, said the deal was a milestone on the way to peace.
"It's a very big achievement. I do hope it will bring friendship between our ethnic groups," he said. "Everybody wants to switch to disarmament and reconstruction."
Some Pashtuns, the country's largest ethnic group, had pressed until the last for the charter to reverse what they say is the domination of Dari names for public institutions such as universities and courts.
But they went along in the end.
"It will help demilitarize the capital and inject new freedom into education, the media, normal life," said Khalid Pashtun, a fervent advocate of his kinsmen's rights.
The accord gives the U.S.-backed Karzai the presidential system he had insisted on, although only after some notable compromises.
Karzai has argued strongly for a dominant chief executive to hold the country together as it rebuilds and reconciles after more than two decades of war, and said he wouldn't run again if he didn't get his way.
It was also a triumph for the United States and United Nations, whose officials worked tirelessly to broker a backroom agreement to bolster a peace process begun after the ouster of the Taliban two years ago.
In three weeks of often rancorous debate, religious conservatives forced through amendments to make the constitution more Islamic — possibly with a ban on alcohol.
On the other hand, wording was changed to spell out that men and women should be treated equally — a key demand of human rights groups.
But Sonali Kolhatkar, an advocate for Afghan women, told CBS News Correspondent Melissa McDermott that the rights guaranteed to women are only on paper, for now.
"A piece of paper does not necessarily protect Afghan women and children from the horrors of what Afghanistan has seen for many years," she said.
Kolhatkar says she's also troubled by the constituion's requirement that no laws be passed that go against the laws of Islam.
"If Islamic law requires that an Afghan woman be stoned to death for adultery, that is not something that the constitution can protect her from," Kolhatkar said. "Afghan women have to worry about this because it essentially can undercut any rights they have won in the constitution."
In the one of the most bruising tussles involved in the creation of the constitution, minorities such as the Uzbeks and Turkmen from the north won official status for their languages in the areas where they are strongest, with only grudging acceptance from Pashtuns.
Rivals of Karzai, mainly from the Northern Alliance faction which helped U.S. forces drive out the Taliban for harboring Osama bin Laden, strengthened parliament with amendments giving it veto power over some key appointments and policies.
A new commission is to be set up to monitor implementation of the constitution — another potential power base for a rival.
But with no provision for a prime minister or strong regional councils, the wide-ranging powers sought by Karzai in a draft released in November appeared to have survived mainly intact.
The charter makes the president commander in chief of the armed forces, charges him with determining the nation's fundamental policies and gives him considerable power to press legislation.
"The strong presidency was quickly settled," Khalilzad said, although he acknowledged parliament had been bolstered. "It's more balanced in that way."
Observers said it was vital for the constitution to command broad support, and analysts have voiced concern that Karzai's reliance on the support of his fellow Pashtuns could make him a partisan figure in the eyes of the country's myriad minorities.
That could make it more difficult to push ahead with other aspects of the U.N.-sponsored peace drive, especially the disarmament of the unruly regional factions that control much of the country.
The world body has warned that taming the factions, and persuading some of the estimated 100,000 militia fighters still roaming the country, is essential to prevent intimidation from spoiling the presidential elections scheduled for June.
It has also warned that the poll could be delayed until September to give Afghan and U.S. troops more time to improve security in the south and east, where Taliban insurgents and their allies regularly attack troops, government staff and aid workers.
"The challenge locally is to build on what was positive and attend to what was negative," Brahimi said, including poor security across the country for ordinary Afghans which the constitution is supposed to help solve.
"They live in fear all the time. The fact is there is no rule of law," said the U.N. envoy.