By Oana Lungescu
BBC News, Brussels
A draft constitution was previously rejected by French and Dutch voters
Legal experts from the 27 countries of the European Union have agreed on a draft reform treaty.
The treaty is set to replace the defunct European constitution rejected by French and Dutch voters.
Portugal, which holds the EU presidency until the end of the year, hopes to get agreement on the treaty at an EU summit in Lisbon later this month.
Possible domestic opposition to the treaty in Poland and Britain mean they may present the biggest hurdles.
The treaty aims to streamline the workings of the EU bloc, which has almost doubled its membership in the last few years.
Legal experts have been making slow progress on the EU reform treaty since July, but they have now apparently got a text they can all agree on.
As the negotiations were conducted mostly in French, it will take until the end of the week to translate and make it more widely available on the internet.
The final work focused on Britain's opt-out from the sensitive area of judicial co-operation and the powers granted to the EU's highest court over member states' compliance with EU rules.
A Portuguese diplomat said Britain should be satisfied with the outcome, but he insisted there was no guarantee of an agreement at the Lisbon summit. He said it was not the end of the process and it was wise to be cautious.
One reason for caution is Poland, increasingly seen in the EU as an unpredictable partner. With an early election scheduled just two days after the summit, Warsaw is bound to stick to its demands for greater powers to block EU decisions.
Meanwhile, there is intense speculation in Britain that Prime Minister Gordon Brown may also call a snap election, and opposition conservatives have made it clear they will turn a demand for a referendum on the new EU treaty into a key political battleground.