European Union leaders meeting in Brussels tonight agreed on a historic constitution -- the first ever forged for the 25-nation, 450 million-person bloc -- ending two contentious days of negotiations that exposed deep divisions and clouded prospects for future cooperation.

The mood of success was tempered by the reality that the constitution still faces formidable hurdles. Many EU nations have announced they will hold referendums on its adoption, and rejection by one country would sink it. Chances for passage look particularly problematic in Britain, where a small anti-Europe party recently made election gains, and in Denmark, which has a history of rejecting European treaties.

The EU operates under a complex web of treaties, and proponents of the constitution say it would streamline decision-making and, by creating a permanent president and foreign minister, give the union greater standing in world affairs.

Joy was also muted because the leaders failed to agree on a replacement for Romano Prodi of Italy as president of the European Commission, the EU's executive arm. Faced with a deadlock and no candidate acceptable to all the countries, the leaders agreed to postpone the choice until a future meeting.

Irish Prime Minister Bertie Ahern, who holds the EU's six-month rotating presidency and chaired the meeting, worked feverishly to secure language that allowed agreement on the constitution and received a standing ovation for his efforts. The most vexing question was how to apportion voting power among countries of vastly different sizes -- the same question that torpedoed hopes for a constitution when the leaders met in December.

A deal was secured when small countries dropped their insistence on more voting power, Britain won agreement to preserve its veto over such sensitive areas as taxation and foreign policy and Roman Catholic countries led by Poland dropped their demand that the constitution include a reference to God and Europe's Christian heritage.

Despite the last-minute agreement, this meeting, coming after a six-month cooling-off period, seemed more acrimonious than last December's session. Relations seemed particularly strained between British Prime Minister Tony Blair on one side and French President Jacques Chirac and German Chancellor Gerhard Schroeder on the other.

Having each suffered a severe rebuke from voters in European parliamentary elections Sunday, all three leaders appeared in no mood to compromise, analysts and diplomats said.

Blair's official spokesman told reporters, "We are operating in a Europe of 25, not six, or two, or one" -- a clear broadside directed against France and Germany, which often fashion themselves as the engine behind EU integration.

Chirac was equally combative, telling the gathering, "From now on, there are limits that cannot be overstepped," according to his spokeswoman, Catherine Colona. Signaling that France was tired of making concessions to Blair, Chirac said, according to Colona, "We will not accept any further retreat from what has been proposed by the Irish presidency."

"The problem now is the personality clash between Tony Blair and Jacques Chirac, because both have to look as tough as they can before their own voters," said Heather Grabbe, a researcher at the London-based Center for European Reform. Blair and Chirac, she said, "seem to be going toe-to-toe."

The battle over finding a new president of the European Commission proved even more contentious than the fight over the constitution, exposing anew many divisions that first came to light during the Iraq war.

Britain, the United States' main ally in Iraq, blocked appointment of Belgian Prime Minister Guy Verhofstadt, the preferred candidate of France and Germany, because he was seen as too vocal in opposing the war. In return, France vetoed the nomination of a Briton, Chris Patten, the current EU external affairs minister, saying the next commission president should come from a country that uses the common currency, the euro, and is inside Europe's open-borders zone. A Briton would be disqualified on both counts.

Originally, the new EU president was supposed to be chosen Thursday, after a working dinner of the 25 heads of state. But that dinner was described as acrimonious, with no country giving ground and no compromise candidate emerging.

"Both sides have toughened their stances," said Marco Incerti, a researcher with the Brussels-based Center for European Policy Studies. "The British have said never Verhofstadt, and the French said, okay, never Patten. . . . . It doesn't help to have this kind of confrontational language."

Special correspondent Stina Lunden contributed to this report.

Prime Ministers Tony Blair of Britain, right, and Silvio Berlusconi of Italy, left, two supporters of the Iraq war, get ready for a group photo at summit.