By Matthias Blamont

CALAIS, France (Reuters) - French authorities said on Wednesday they had finished clearing the "Jungle", a shanty town outside Calais built by migrants who had hoped to cross to Britain but who are now mostly being dispersed around France.

The operation passed off peacefully for the most part, though some migrants torched tents and shelters in a last act of defiance as their hopes of a new life in Britain evaporated.

"This is the end of the 'Jungle'," Calais regional prefect Fabienne Buccio said. "Mission accomplished."

A total of 5,596 adults and children have been brought from the cold and damp of the Jungle for resettlement, the interior and housing ministries said in a joint statement.

That figure includes 234 minors taken to the United Kingdom since last week, the ministries said. The transit center on site remained open on Wednesday night for migrants wishing to be resettled in one of 450 reception centers scattered across France.

Earlier in the day, riot police spread out around the camp, and fire trucks moved in to put out blazes that sent plumes of smoke into the sky.

Migrants fleeing poverty and war in the Middle East, Asia and Africa had gathered in Calais hoping to cross the short stretch of sea to Britain by leaping on trucks and trains, or even walking through the tunnel under the Channel.

Britain refused to accept the vast majority. High fences were built to keep them away from the port traffic, but still they came.

Local opposition to the sprawling slum, along with growing criticism from right-wing politicians, finally stung the French government into action.

IMMIGRATION AND BREXIT

"We need to be vigilant and provide guarantees so that the camp does not reappear," Calais Mayor Natacha Bouchart told journalists at the Jungle camp entrance, according to French radio Europe 1.

The numbers of irregular migrants reaching Europe are sharply down on the 1.3 million who arrived in 2015. But more than 300,000 have made the hazardous Mediterranean crossing in 2016 so far, and many are likely to head for Britain.

Story continues

The British referendum vote this year to quit the European Union was in large part driven by worries over immigration, and stoked by scenes of the Calais migrants trying to force their way in.

Now that Britain is leaving the EU, right-wing French politicians want to tear up the agreement under which Britain's border controls are conducted in France.

Many arriving in Europe see Britain as their best hope of making a new life due to its plentiful jobs and English language.

Hamid, 30, from Afghanistan, said he had been among those setting fire to shelters in the Jungle, and still hoped to cross the Channel to Britain.

"We don't care about problems that are to come after this. We did it because we don't want to stay in France," he said.

"We want to go to England and England only. It doesn't matter if I go to jail here."

France has repeatedly urged Britain to take in all the unaccompanied minors at the camp, while Britain has said it expects to accept about half of them.

(Additional reporting by Pierre Savary and Mathieu Rosemain; Writing by Andrew Callus; Editing by Andrew Roche)