CAIRO President Mohamed Mursi now seems assured of pushing through Egypt's new, distinctly Islamist constitution - but by a margin slim enough to embolden his opponents in next year's parliamentary election.
That could be good news for Egypt's nascent democracy and its battered economy if it encourages political rivals to fight their battles at the ballot box rather than in the streets, where clashes have alarmed both investors and tourists.
Yet Mursi will have little respite as he braces for the unenviable task of winning public support for urgent economic policies to rein in a crushing budget deficit that are bound to be unpopular in a nation deeply divided by his actions.
"The results of the referendum do not put an end to this state of polarisation in Egyptian politics," said Mustapha Kamal Al-Sayyid, a professor of political science at Cairo University.
The Muslim Brotherhood's party, which propelled Mursi to power in a June election, said its unofficial tally for Saturday's first-round vote on a controversial constitution showed 57 percent of voters backed it, supporting liberal opposition arguments that many felt the document too partisan.
A second round of the vote now looks likely to go the same way on Saturday, as it will be held in districts with more Islamist sympathisers. But even if another, possibly bigger Yes vote pushes the constitution through, the poll on a national charter has underlined the political divisions that Egypt faces.
"This puts major hurdles before President Mursi because the economic measures he planned to introduce ... require a national consensus," said Sayyid, arguing that the Islamists, who have dominated other ballots this year and last, were losing ground.
Mursi's first attempt to implement tax increases, about a week before the vote, lasted only a few hours before he withdrew them amid howls of public anger, which his opponents exploited.
His prime minister has promised a "national dialogue" to explain the government's determination to protect the poor, but Mursi cannot wait long as the measures are seen as essential to securing a vital $4.8-billion International Monetary Fund loan; it was delayed by a month immediately after his policy U-turn.
Leftists, socialists, Christians and liberal-minded Muslims, freshly united in opposition to Mursi's November 22 decree to expand his powers in order to push through the Islamist-tinged constitution, have capitalised on public anger over the economy.
After liberals split their voter base in previous elections, the Brotherhood's party may still be counting on the opposition fracturing before the next parliamentary election, due a couple of months or so after the constitution is approved.
"If the secular forces fail to be united, this will in the end lead to a greater gain for the Freedom and Justice Party," the deputy leader of the Brotherhood's political party, Essam el-Erian, told Reuters. He also dismissed evidence of divisions in society as something present "all over the world".
But Islamists may find criticism starting to stick. Some Egyptians who voted Yes were not Islamist loyalists but instead were simply weary after two exhausting years of turmoil since military-backed strongman Hosni Mubarak was overthrown.
Their slogan throughout the referendum build-up was a call for "stability" so that the economy could be put right.
Those Egyptians, along with others who voted No, may be more receptive to opposition charges that Mursi is mishandling the economy and out of touch with the poor while he pushes through measures seen as favouring the Brotherhood and its allies.
That is likely to be an increasingly fierce battleground as the parliamentary election looms.
"The opposition comes out of this in a stronger position," said Shadi Hamid of the Brookings Doha Center. "Mursi and the Brotherhood were hoping for a decisive victory to claim vindication. But they are not going to be able to do that.
"This is a good result for Egypt's democratic process," he added. "It shows non-Islamists can gain ground against Islamists in democratic elections. They do have an interest in shifting the battle from the street to institutionalised politics."
There are signs of a trend. When a first, temporary, constitutional framework was put to the vote just weeks after Mubarak's downfall - also opposed by liberals and backed by Islamists - it secured more than 75 percent of the vote.
Islamists then swept up a big majority in voting for the interim parliament, securing about 70 percent of seats. But Mursi's presidential win in June was less convincing; he took about 52 percent of votes against a Mubarak-era general.
Saturday's vote confirms that non-Islamists are starting to form a more credible challenge. Yet more liberal-minded politicians still have their work cut out.
The Brotherhood, founded in the 1920s, has built up an unrivalled social support and charity network across Egypt, expanding even as Mubarak and his predecessors oppressed them.
That has helped them do well in the more localised politics of parliamentary polls, turning out the vote in neighbourhoods.
Liberals have no such history of organisation. Though the Popular Current movement of leftist Hamdeen Sabahy and Mohamed ElBaradei's Constitution Party have broadened their appeal, they boast nothing like the grass-roots presence of the Islamists.
Mursi may also have a chance to weather the economic storm. At least some investors may be happy to see a constitution in place as it resolves one of their worries that the transition to democracy was drifting, even if plenty more concerns remain.
After the unofficial referendum result, Egypt's benchmark stock market index rose 2.7 percent, though the pound is still bumping along at its weakest against the dollar in eight years.
"Given how severe the downside risks seemed just a week or so ago, a fiercely contested referendum attracting a decent turnout is a positive outcome," said HSBC economist Simon Williams.
"However polarised the debate may have become, if it stays within the institutions of the state, then there is some prospect of the political transition moving forward," he said.
Nevertheless, the result does not mean an end to protests.
A spokeswoman for the Popular Current, Heba Yassin, said Egyptians were still "inflamed and furious" and added that the "final word will come from the Egyptian street".
(Additional reporting by Shaimaa Fayed; Editing by Giles Elgood and Alastair Macdonald)