By Paul Reynolds
BBC News website world affairs correspondent
The British presidency of the EU has staggered to the end of its six-month stint with a success on the budget, which it left late and nearly missed.
Leaders agreed on the budget proposals after two days of talks
The deal was reached with the post-midnight shenanigans typical of these negotiations, and came without panache and inspiration, and with the usual grudging compromises.
A presidency cannot be judged a failure with such an agreement under its belt, but the manner of its achievement means that it cannot be judged as a resounding success either.
It left everyone curiously dissatisfied.
UK Prime Minister Tony Blair was criticised at home for giving away too much and criticised in Europe for not giving it away earlier.
He was also praised for his "courage" by French President Jacques Chirac - a sure sign that London had given something away.
Mr Blair had dealt himself a poor hand by having agreed in 2002 to an envelope of agricultural spending for the period of 2007 to 2013.
At the time, it had seemed a sensible thing to do, in that it put a ceiling on farm spending. But it gave the French a lock on these negotiations, as Mr Blair tried to get that all opened up in exchange for giving up part of the rebate.
That rebate was won by former UK Prime Minister Margaret Thatcher at Fontainebleau in 1984 and had the virtue of simplicity. It gives back to the UK two-thirds of the difference between what it pays in and what it gets out of the budget.
The UK has agreed to give up some of its budget rebate
But at some stage, it had to come to an end or be modified, and everyone knew it. The issue was how and when, and by how much.
In the end, Mr Blair got a review of EU spending before the budgetary envelope ends in 2013 - and had to give up some of the increases in the rebate which will rise anyway as the overall budget goes up. It was a patched-up sort of affair with no great passion behind it.
The British tactics of leaving everything to the last moment did a lot of collateral damage along the way to British allies in Eastern Europe such as Poland.
In the end, it was the wider need for British diplomacy to keep its windows open to the east that prompted Mr Blair to settle.
The newer members also learned a lesson and came face to face with the reality of the EU - a bruising encounter over cash.
At least a deal was done and the British government can claim this as an achievement along with the agreement to start accession talks with Turkey, which it championed.
In fact, history will probably judge the decision over Turkey - if it leads to Turkish membership - as far more significant than another budget deal cobbled together in the small hours.
However, one long-time observer of European affairs, John Palmer, who is retiring soon as political director of the European Policy Centre in Brussels, sees hope for the future of the EU now that this budget business has been done.
"The budget deal does offer light at the end of the dark European tunnel," he told the BBC news website.
"It possibly marks the moment of rebound after the failure of the constitution and the long downturn in European economics and politics.
"One of the significant features of these talks was the role of the new German Chancellor [Angela] Merkel and therefore the re-emergence of Germany as a serious European player.
"We can now look towards the German presidency in the first half of 2007 for a relaunch of the wider European debate which will include the future of the constitution," he said.
The near-crisis also emphasised another long-standing point about these "Buggins' turn" presidencies.
To have a country trying to give leadership to the 25-member group while protecting its own national interest, as Britain had to do this time, was almost painful to watch.
France and the UK have long been at odds over the budget
It illustrated once again to EU veterans and novices alike how absurd the current presidency has become.
No wonder the proposed constitution called for a four-year presidency to be led, not by one of the players in the game, but a figure chosen by the member states.
Most presidencies are rightly forgotten immediately as the new team takes over and the circus moves on.
Long-serving EU officials, even when pressed, can recall only a handful of significant presidencies.
Journalists tend to remember them for the goody bags they get from the presidency hosts - the Irish being especially generous with salmon and whisky.