The Taoiseach, Bertie Ahern, has said a referendum will be held some time next year on a new EU treaty to reform the bloc's institutions. 

Agreement came early this morning after hours of intense negotiation.  Deadlock was broken when the German Chancellor, Angela Merkel, threatened to go ahead without Polish agreement if necessary.

Warsaw had vigorously opposed provisions in which voting power is based on a country's population. 

Poland's President, Lech Kaczynski, said afterwards that his government had not caved in to pressure.

This was a summit that teetered on the brink of disaster, and a potentially very serious rupture in Polish-German relations

Only direct intervention by French President Nicholas Sarkozy and Britain's Tony Blair brought the situation back from the brink, with the Poles finally accepting a compromise on the voting system in the early hours of this morning.

Under it, Poland will continue to enjoy an advantageous position for another ten years.

Britain, France and the Netherlands all achieved changes which will enable them to ratify the new treaty without holding referendums.

But Belgium and several other countries objected to these changes, delaying the end of the summit until 4.30am this morning.

The Taoiseach said it was a good deal for Ireland and Europe, because the new treaty will keep around 90% of the provisions of the EU constitution, which was agreed during the Irish presidency three years ago.

Leaders endorsed the convening of an Inter-Governmental Conference, which will draft the actual treaty to replace the EU constitution rejected by French and Dutch voters in 2005.

The President of the European Commission, José Manuel Barroso, said that the EU had succeeded at what it had set out to do in reaching agreement on a mandate for an institutional settlement.

'There is now a consensus on a reform treaty for the European Union,' Mr Barroso said. 'This shows that Europe is on the move, and on the move in the right direction.'