Good timing. Concerns about migration, terrorism and access to energy supplies are refocusing EU attention on improving relations with the nations of North Africa, which are emerging from political and economic obscurity. Libya is fast shedding its status as a global pariah, Morocco has recast itself as a Westernized quasi democracy and tourist magnet, and Algeria—now splurging $150 billion on an infrastructure-renewal program—is awash in petrodollars. French President Nicolas Sarkozy, speaking immediately after his election in May, declared: “The time has come to build a ‘Mediterranean Union’ that will be a bridge between Europe and Africa.”

If the details of Sarkozy’s plan are hazy, the outline is clear enough: a loose economic union of all the countries around the Mediterranean rim, linked to the EU but with its own trading agreements as well as regular meetings of national leaders. That’s visionary stuff: nothing less than a single community of nations, rich and poor, Muslim and Christian, striving together for a better future in which post-colonial animosities can be forgotten. Says Jean-Louis Guigou, head of the Economic Forecasting Institute of the Mediterranean World: “This is the great work of the century.”

Other Europeans are making similar moves. Witness Madrid’s commitment to building a high-speed rail link beneath the Strait of Gibraltar, and Italy’s courtship of Libya, its former colony in North Africa. Already it’s getting much of its gas from a new pipeline between Sicily and the Libyan coast, funded in part by the Italian energy group ENI.

Such shows of neighborly interest date at least to 1995, when the European Union began working to engage the entire Mediterranean region—including Israel and the Palestinian Authority—in the Barcelona Process, which promoted democracy, development and trade. One of the EU’s motives was to slow immigration: if it could boost North African living standards, migrants would be tempted to stay home.

But Barcelona soon disappointed amid arguments over Middle East policy. “What we have had to do is sail against the wind,” concedes Juan Prat, Spain’s special ambassador for Mediterranean affairs. “What we like is that Sarkozy has given a new push to the process.” His wife has been busy too: shortly after Cécilia Sarkozy flew to Tripoli, Libya, to help secure the freedom of six foreign medics, France struck a lucrative arms deal with the Kaddafi regime.

There are also energy deals to be done. Algeria is already Europe’s third largest supplier of natural gas, after Russia and Norway. Plans are now afoot for a new gas pipeline that would bring supplies 4,300 kilometers across the Sahara from Nigeria to a terminal on the Algerian coast.

Security chiefs, too, know the value of cross-border support. Happier relations between Spain and Morocco already mean closer ties in combating the threat of Islamic extremists. (Remember it was Moroccans who were blamed for the Madrid railway bombings in 2004.) After renouncing terrorism itself, Libya is collaborating in the war against it. And Algeria has been working closely with foreign partners to check the expansion of Al Qaeda in North Africa.

Europeans, of course, aren’t the only ones angling for closer ties. Morocco is a major recipient of U.S. aid. The Algerians recently signed a $7 billion arms deal with Moscow. China is winning construction contracts in Algeria and oil deals in Libya. The United States, the biggest foreign investor in Algeria, just signed a nuclear-power deal. You don’t need a postdoc in Mediterranean studies to see that if Europe won’t cement its friendships in the region, others will.