EU leaders convinced Polish President Lech Kaczynski to accept a compromise. The EU summit had been due to end June 22 but was extended to allow last-minute negotiating.
Finally, after two days of tough talks, EU leaders meeting in Brussels finally reached a compromise.
The agreement reached in the early hours of this morning preserves much of the planned EU constitution, which was rejected by voters in referendums in France and the Netherlands in 2005.
It envisages the creation of a long-term president of the EU, a foreign-policy chief with increased powers to represent the EU on the world stage, and a bigger say for the European and national parliaments.
The agreement also delays from 2009 until 2017 a new voting system that was the main stumbling bloc during the negotiations.
Poland had feared a reformed voting system would favor bigger countries, especially Germany, at Warsaw's expense.
Germany -- the current holder of the EU Presidency -- had threatened to launch treaty talks without Poland.
French President Nicolas Sarkozy is being given credit for helping to broker the final compromise. He called the new agreement one of the most important in recent history.
"There are no winners and there are no losers, and that was important," he said. "Europe went back to work and the mandate is clear and precise and the dates are fixed, and now you are going to get a Europe with institutions. Listen, it's very important news. It's maybe the most important European summit in years and years.''
Kaczynski told reporters that Poland is now "capable of much better cooperation" with France, Britain, and Germany.
He outlined the last-minute negotiating. "There was one short telephone conversation with [French] President [Nicolas] Sarkozy, just 30 seconds, not more. I was talking to President Sarkozy. I also spoke with [British] Prime Minister [Tony] Blair and [Polish] Prime Minister [Jaroslaw] Kaczynski and, well, there was an agreement concluded during the last meeting. During the last meeting, there was some hesitation, but Prime Minister Kaczynski thanked Prime Minister Blair and that's it.''
Polish Foreign Minister Anna Fotyga said Warsaw's position has been "enhanced" after what she called "hard-core negotiations."
Outgoing Prime Minister Blair also expressed his satisfaction. ''The constitutional treaty was put to one side. We went back to a conventional treaty. The four essential things that we in the U.K. required in order to protect our position have all been obtained.''
Britain wanted to maintain national control over foreign policy, its judicial and police system, tax and social security rules, and an EU charter of fundamental rights.
German Chancellor Angela Merkel said the bloc now has a "detailed and clear mandate" for an intergovernmental conference that will draft the actual treaty.
Merkel said further enlargement of the bloc depends on the new treaty. "The fact that we now have a good chance of having a treaty in 2009 opens the road for further enlargement. The Nice treaty narrows things down to 27 member states and wouldn't allow any further enlargement, and that was one of the reasons why we said we had to act quickly.''
The treaty will need to be ratified by the parliaments of each of the EU's 27 member states -- not in referendums -- before entering into force in mid-2009.