When Corporal James walked in on his fiancée sleeping with another man he threw him through a second-storey window and beat him with a wrench until the police arrived.

The former US Navy signalman was facing seven years in jail for what was — by his own account — a frenzied assault. But on March 9, 2007, just three days before he was to stand trial, James, 22, packed a change of clothes and some cigarettes into a small duffle bag, said goodbye to his mother, his stepfather and his sister, and flew to Paris to start a new life.

Today he is on his third tour of duty in Afghanistan — but this time it is with the French Foreign Legion. “The legion was a second chance, an opportunity to reinvent myself,” he said. “It was either here or prison.”

The legion, founded in 1831, is one of the only regiments in the world that almost anyone can join — no matter where they are from or what they have done. James is one of more than 700 legionnaires, an extraordinary blend of misfits, mercenaries, runaways and romantics, fighting the Taleban in the mountains east of Kabul. Among them are a handful of Britons, scores of Russians, and others from as far apart as Algeria and China.

“Nine out of ten guys here are looking for a second chance,” said James. “A big thing is guys from Eastern Europe and Russia. A lot of them are here for the money, the rest were in gangs, or in trouble with the police.” James is not his real name. The legion gave him a new identity when he signed on in Aubagne, in the South of France. French army rules prevent journalists publishing soldiers’ surnames — even when they are false.

“If you join under a false name you can’t have any contact with your family or your past life until you get your name back,” said Adjutant-Chef Craig, 43, the Scottish sergeant-major in charge of discipline at the legion’s Afghan headquarters in Surobi.

A legionnaire can apply to have his real name reinstated after a year — if no one is looking for him. Others join to get a French passport, which they are entitled to after five years’ service. At least four Afghans have earned their képis blancs — the legion’s trademark white caps — in recent years, but none of them are deployed as part of Nato’s mission. In a rare indulgence, legionnaires can choose not to fight with their unit if it is deployed to their homeland. “It avoids divided loyalties,” said Craig.

New recruits endure a gruelling 30-day indoctrination at the legion’s “farm” in the Pyrenees, where they memorise the Legionnaire’s Code of Honour and promise, in unison, to fight to the death and never surrender.

The result is one of the fiercest units in Nato’s arsenal. But their current mission, much to the soldiers’ frustration, is to befriend the population, not fight them. “Most guys here are looking for a gunfight — we’re looking for a war,” said James. “It doesn’t matter who’s war, or for what reason.”

The legionnaires in Afghanistan have endured their share of violence. Adjutant-Chef Alex, from Newcastle upon Tyne, is expecting his fifth citation for valour for his role in a series of bloody firefights close to where ten French soldiers were killed in an ambush last year: “We got hit from 360 degrees,” he said of a recent battle. “Two of the Americans we were with were hit by bullets — one in the back plate, two bullets in the helmet and one in the hand. When the first helicopter came in, an RPG [rocket-propelled grenade] exploded a few metres away.”

The legionnaires are part of an effort to help the Afghan Government to stretch its authority into the upper reaches of the notorious Uzbin Valley, on the eastern fringes of Kabul province. Surobi sits astride a key infiltration route that links insurgents from Pakistan to the Afghan capital.

High in the Hindu Kush mountains, Uzbin has long been a safe haven for Taleban insurgents, and Hezb e-Islami fighters loyal to Gulbuddin Hekmatyar, the former Prime Minister who is now on America’s most wanted list.

Together with other French and American troops in neighbouring Kapisa province, the legionnaires are also trying to secure the equally volatile Tagab Valley so that engineers can finish work on a strategic ring road that will link eastern and northern Afghanistan, removing the need to drive through Kabul. The insurgents seem determined to stop them. “We get hit whenever we go above the 44th,” said Alex, referring to a grid reference on the military maps.

Between operations the soldiers relax hard in the open-air Hacienda bar at Forward Operating Base Tora that serves pastis and Kronenbourg for €0.60 (54 pence) a bottle. The bar is named after a legendary battle in 1863, when sixty-two legionnaires and three officers refused to surrender to almost 2,000 Mexican troops.

Hardcore pornography has been banned on the orders of Colonel Benoît Durieux, who commands the force, but there is certainly no “two cans of beer” limit that sometimes applies to British soldiers in Afghanistan.

Alex, 43, joined in 1987 after being rejected from the British Army on medical grounds. His brother joined the Royal Engineers. “I learnt French the hard way,” he said. “I could ask for a campsite and a hotel but it wasn’t much use. Every time I spoke English or made a mistake in French, I got a thick ear.” Warrant Officer First Class Tom, from Liverpool, has lasted almost 30 years and served in nine countries — but it took him 12 years to get his name back. “It depends how long it takes them to forget why they changed your name,” he said.

The 52-year-old, who has four children, joined on December 19, 1979 — a week before the Soviet Union invaded Afghanistan. He declined to talk about his past, and it is a legion tradition that no one should ask. But he said: “It was a lot more basic back then than it is today … It was a lot rougher. Today there are more rules.”

When Tom joined, legionnaires were not allowed to live off-base or get married until they had reached the rank of sergeant or completed five years’ service. If they were serving under a false name they were paid in cash and denied the right to a bank account. The strict rules of the legion force soldiers to embrace the regiment’s motto, Legio Patria Nostra — the legion is our homeland. “It’s like a second family,” said Tom. In the late 1980s the number of Englishspeaking recruits was about 25 per cent of the total. Today it has fallen to just 3 per cent, soldiers said.

Officers — almost all of whom are French — claimed that most recruits are not criminals but adventurers captivated by the legion’s allure, fuelled by books and Hollywood films. Among their most famous recruits was the American poet Alan Seeger, who fought and died with the legion in the First World War.

“I’m no poet,” said Tom. “If I had my time again, I wouldn’t have made the first mistake. I owe the legion a lot because when I needed them they opened the door and let me in.”

The modern legion will not accept murderers, rapists or child molesters but recruits can still join without showing any kind of identification.

Niaz, 34, said he was a graphic designer at an Algerian advertising agency before he joined. Half-Russian, half-Algerian, he joined so as not to think “meanly of myself for not having been a soldier”.

“I had one life, and there was a part of me that wanted to try out military life … But I didn’t want to be an Algerian soldier, because I don’t agree with my Government.”

One Mongolian man cycled halfway across the world to find a recruiting office on French soil. One of the soldiers in Camp Tora is a Harvard graduate. Officers say that about eight people apply for each place, and few get in. The unit is famed for its brutal initiations and strict discipline.

“A lot of guys desert,” said James. “But it’s also part of what people join for. If the legion became a sissy army, guys wouldn’t come, and if they didn’t come we wouldn’t exist.”

Never surrender

The French Foreign Legion has a force of 7,699 legionnaires and non-commissioned officers who come from 136 countries

The force was created in 1831 by Louis Philippe because foreigners were forbidden from serving in the French Army after the overthrow of Charles X the year before

Legion soldiers served in the Gulf War of 1990-91; Cambodia and Somalia in 1992 and 1993; Rwanda in 1994, Bosnia, Kosovo and Macedonia from 1993 to 2003; and the Central African Republic in 1996. They are currently deployed in Afghanistan, Kosovo, Chad and Ivory Coast

The only woman to belong to the legion was Susan Travers, a Briton. Attached to the legion as a driver during the Second World War, she refused to leave the Libyan fort of Bir Hakeim when the female personnel were ordered to depart in 1942. She stayed with her lover, a legion colonel, and led a convoy in a breakout through minefields and three rings of German tanks. She was accepted as a full member after the war

New legionnaires vow to “act without passion or hatred . . . respect vanquished enemies . . . never surrender your dead, your wounded or your weapons”

The legion has featured in films as diverse as The Mummy, Beau Travail — which takes its name from the much filmed legion adventure novel Beau Geste, Billy Budd and Follow That Camel, one of the Carry On films