Serbian economist Laza Kekic has long argued that it would be a mistake for his country to join the European Union. Recently, he gave up his personal campaign, concluding that the determination of regional governments to become part of the bloc was "indestructible."

Proof of Kekic's conclusion came in the diplomatic coup pulled off by Catherine Ashton, the EU’s foreign policy chief, last week. The settlement she secured between Serbia and its former province Kosovo was historic in the full sense. It was also testimony to the enduring pull factor of the EU.

Kekic made a good case. The union, after all, is in a mess. The euro could yet collapse, bringing economic mayhem. Besides, inside the EU, small states such as Serbia have very little influence over the way in which decisions are made. Yet so badly do Serbs and Kosovars want to join the bloc that they ignored those arguments, plus deep national scars and red lines, to cut a deal with each other on April 19.

First a little about the agreement: Serbia won't have to recognize Kosovo as an independent state, but it will accept the Kosovar government's jurisdiction over the whole territory; in exchange, Kosovo will grant significant autonomy to Serb-populated areas in the north. It sounds simple, but it was years in the making.

Kosovo’s population is overwhelmingly ethnic Albanian. In the old Yugoslavia, it was a province of Serbia, which in turn was one of the country’s six constituent republics. After Yugoslavia broke up, Kosovo Albanian guerrillas launched a war of independence, in 1998. The following year, the North Atlantic Treaty Organization entered the conflict on the side of Kosovo's Albanians and drove out the Serbian administration, replacing it with a United Nations one. In 2008, Kosovo declared independence.

Serbia has fiercely resisted this secession by diplomatic means, backed by Russia and China, but cannot reverse it. Almost 100 countries (the exact number is disputed), including the U.S. and all but five of the EU’s 27 members, now recognize Kosovo as a state.

Despite opposing Kosovo’s independence, few in Serbia want Kosovo’s Albanians to be an integral part of Serbia’s body politic again. The issue has been how to escape this conundrum. Kosovo has a population of 1.7 million people, of whom about 140,000 are Serbs. One third of this Serbian minority live in a northern enclave that has remained outside the control of the ethnic Albanian-dominated government. These Serbs want nothing to do with the Kosovars, but will now have to make an accommodation, just as the other two-thirds of ethnic Serbs who live in other parts of the territory have begun to do in the last few years.

Predrag Koraksic Corax, Serbia’s best-known cartoonist, has it just right. He shows Ashton as a referee in a boxing match, holding up the victorious hands of two battered fighters, the prime ministers of Serbia and Kosovo.

The day the deal was struck, I was in Bratislava, the Slovakian capital, for Globsec, the country's annual conference on international affairs. That evening, Serbian and Kosovar diplomats sat side by side discussing the agreement at a happy dinner. Just a year ago, this could not have happened -- Serb diplomats were instructed to avoid speaking to Kosovo officials at all.

On April 22, the EU delivered the first part of its side of the bargain. In exchange for the compromises that the Serbs and Kosovars made, the European Commission formally recommended that the EU should in June set a date for Serbia to begin membership talks. The commission also recommended that Kosovo, further behind in the accession process, should be allowed to start negotiations on an early step known as a Stabilization and Association Agreement.

Implementing last week's deal will be difficult, and joining the EU is a long way off for both Serbia and Kosovo. But were it not for the lure of the EU, this agreement would never have been struck. In 2003, the whole region was given a promise that it would eventually join and that stands. Moldovans have no such promise. Neither do Armenians, Azerbaijanis or Georgians. There is no EU leverage available to help these countries resolve their frozen conflicts, and there is little sign that they will.

The EU is, of course, no panacea. In recent years, the problems of the euro area have led to an economic recession in the western Balkans, too. But, despite their conflicts and recent memories of war, the leaders of the region keep close tabs on one another and meet constantly. No one wants to be left behind.

On July 1, Croatia will join the EU, becoming the second ex-Yugoslav republic to do so, after Slovenia. Croatia's frontier will then become an external border of the EU. This will cause all manner of problems for Croats, Bosnians, Serbs and Montenegrins, not least because Croatia will simultaneously have to leave the Central European Free Trade Agreement, which eased trade within the western Balkans in recent years. The other countries all understand that the only answer is to catch up with Croatia as fast as possible.

Balkan leaders also understand something that has been forgotten by all too many Europeans, which is that the EU was founded as a peace project. For all its current failings, the organization has been phenomenally successful in achieving that goal. Without a deal between Kosovo and Serbia, I am sure that the region would have floundered. At the same time, last week's agreement could help re-energize progress on untying other Balkan knots, such as the stalled political process in Bosnia, as well as Macedonia’s long-running dispute over its name with Greece.

At a time when many in Europe are questioning the value of the EU, the Kosovo-Serbia deal demonstrates why the Nobel Peace Prize that the bloc won last year was deserved and why the union is worth preserving -- even if the euro should fail.

(Tim Judah, the Europe correspondent for the World View blog, is a correspondent for the Economist and author of several books on the Balkans. Follow him on Twitter. The opinions expressed are his own.)

To contact the author of this article: Tim Judah at timjudah@btinternet.com

To contact the editor responsible for this article: Marc Champion at mchampion7@bloomberg.net