HENDAYE, France — The churning currents of Europe's immigration politics swept trainloads of illegal immigrants into this Basque seaside town recently, with strange results.
Rather than catching illegal entrants, French border police found themselves collaring platoons of conspicuous, bewildered migrants as they tried to leave the country for Spain, beckoned by a legalization program.
On the other side of the line, Spanish police swarmed usually unguarded checkpoints on roads and railways to intercept border-crossers, then herded them back into France to beat a four-hour deadline for returning the detainees.
"This kind of thing happens every time a country undertakes a legalization," said Thierry Guiguet-Doron, the chief of the border police in this sector of France's boundary with Spain. "The word spreads and the undocumented around Europe mobilize."
With most internal borders officially erased, travel within the European Union resembles a flight from Los Angeles to Chicago or a drive across the California-Nevada state line. The shuttered inspection booths and skeletal remnants of ports of entry are manned only for spot checks or special operations targeting suspected criminals.
But the boundaries remain politically charged fault lines. The ideal of a unified, borderless community of nations collides with the reality of disparate laws and attitudes regarding sovereignty, security and citizenship. Smugglers and migrants exploit the open borders and diverse policies to float among countries in search of jobs and papers.
The case of Said Farid, a boyish migrant with a bowl-shaped haircut and a nervous smile, illustrates that convoluted reality.
Farid, 30, found himself in the French border police lockup here this month. He claimed to be an Afghan fleeing political persecution, although police believed that he was actually Pakistani.
Farid recounted an odyssey that took him by plane from Pakistan to an unknown destination, a clandestine boat crossing to Italy, furtive road travel by night. In Paris late last month, he joined groups of fellow South Asians who boarded an overnight high-speed train bound for Spain via the Hendaye crossing.
French police say smugglers marshaled part of the exodus but that some migrants were drawn simply by rumors of an opportunity in the south.
Farid insisted that he didn't know that Spain was offering a legalization program. He claimed that he didn't even realize that he had arrived at a border.
"My friend just gave me this piece of paper and said, 'Call this number when you get to Hendaye,' " Farid said in accented English, sitting stiffly against the drab, blue wall of an interrogation room in the police lockup. "I went to the cafe in the train station to use the phone. The French police stopped me and said, 'Show me papers.' And I didn't have any."
In the last two months, border police here caught more than 700 illegal immigrants -- about half the total number of arrests in this sector for a typical year. About two-thirds were Pakistanis, Indians and Bangladeshis whose journeys from their homelands typically cost more than $8,000 in smuggling fees, French officials say. The police also intercepted private buses and vans full of Romanians en route to Spain from Germany and Austria.
In fact, Farid and the rest would not have qualified for legalization in Spain. The initiative that ended May 7 applied only to workers employed in Spain for at least six months. In addition, it granted only legal status in Spain, not the regionwide freedom of movement that allows most EU residents to live in whatever member nation they choose.
But, coming at a time when Europe has fortified itself against immigration, organized crime and international terrorism, the scope of the Spanish amnesty -- about 700,000 applicants were accepted -- exceeded previous programs in the EU and generated tension with France and other neighbors.
Last week, the interior ministers of Europe's five most powerful nations met in Paris to declare new cooperation in a crackdown on illegal immigration. French Interior Minister Dominique de Villepin made it clear that France would not embark on any legalization programs like the one in Spain, calling it a bad idea.
"It's out of the question," Villepin told reporters, labeling France's last two amnesty initiatives, in 1981 and 1997, failures. "Each time, it creates a chain reaction and a wave of new arrivals," he said.
Villepin and his counterparts from Spain, Germany, Britain and Italy said they had agreed on ways to improve coordination. Those agreements are meant to help avoid the repercussions that angered French authorities struggling with an influx of immigrants bound for Spain, the French minister said.
"We don't want any kind of misunderstanding to happen again, any kind of difficulty between our countries," Villepin said. "That's why we think it's good to discuss ahead of time so we can verify that the decisions of each will not have consequences on the others."