PARIS, FRANCE -- When Gabrielle "Coco" Chanel died in her suite at the Ritz in Paris 50 years ago this week, the world mourned the greatest fashion designer of the century.

What no one mentioned was that Chanel had spent World War II in the luxury hotel with her German officer lover working as a spy for both German military intelligence and the SS.

After the war, Chanel -- who had risen from grim childhood in an orphanage to befriend, and sometimes sleep with, some of the richest and most powerful men in the world -- did her utmost to cover her tracks.

So successful was her rewriting of history that AFP, like the rest of the world's media, was taken in.

"At the beginning of the war, Chanel closed her couture house and withdrew to the shores of Lake Geneva, where she lived for 15 years on the royalties of her perfumes," it reported after her death, quoting her official biography.

The reality was quite different.

Although Chanel did close her famous studio on the rue Cambon once the French capital was occupied by the Nazis, her perfume boutique stayed open so German soldiers could buy bottles of Chanel No. 5 for their sweethearts.

GERMAN LOVER

Soon Chanel, then 57 but just as glamorous as ever, was on the arm of an aristocratic attache at the German embassy, Baron Hans Guenther von Dincklage.

Dincklage was 13 years her junior and a spy.

The two took up together in the Ritz where Chanel had lived since 1937, and which had been requisitioned by the Germans to serve as their headquarters and to accommodate the luxury-loving head of the Luftwaffe, Hermann Goering.

Chanel began working for Dincklage's colleagues in Germany's Abwehr military intelligence in return for her young nephew Andre Palasse being released from a German stalag after being captured defending France's Maginot Line.

She became Abwehr Agent F-7124 in 1941, codenamed "Westminster" after her longtime lover the Duke of Westminster, Britain's richest landowner.

DEALING WITH THE DEVIL

More darkly, Chanel began pulling strings to claw back the rights to her perfumes from the Jewish Wertheimer brothers, who had fled to the U.S. when the Germans invaded.

She hoped to use the Nazi's "aryanisation" laws to take back control of the perfumes that she signed away to the Wertheimers in 1924.

But the brothers had foreseen the danger and signed their business over to a non-Jewish businessman before fleeing France.

Chanel's work as a spy involved wining and dining British diplomats in neutral Spain.

But as the tide of the war turned against Germany, and her efforts to get her brand back were frustrated, Chanel set her ambitions still higher -- on ending the war itself.

'OPERATION MODELHUT'

In April 1943 she made one of two visits to Berlin to see General Walter Friedrich Schellenberg, the head of SS intelligence.

He wanted to send word to Chanel's old friend, British prime minister Winston Churchill, that senior SS officers wanted to negotiate a peace.

But "Operation Modelhut" (meaning fashion model's hat, after Chanel's famous boater) ended in farce with Chanel and Dincklage forced to hot-foot it out of Madrid when English socialite Vera Lombardi, who was carrying Chanel's letter to Churchill to the British embassy, denounced them as German spies.

Chanel had arranged for Lombardi -- a mutual friend of hers and Churchill's -- to be released from an Italian prison where she was being held as a British spy.

Lombardi had been close to Chanel since the 1920s, introducing her to her friend, the future king Edward VIII, an admirer of Hitler, and the cream of London society.

SAVED BY CHURCHILL

When Paris was liberated in 1944, Chanel was arrested by the French Resistance but released a few hours later when Churchill intervened.

She was soon safely out of the country in Switzerland when she set up home in a luxury hotel in Saint Moritz.

She didn't return until 1953, when she made a comeback at 70 and reopened her fashion house, having done a deal with the forgiving Wertheimers.

It wasn't until the French writer and Resistance heroine Edmonde Charles-Roux published her book, "Chanel: Her life, her world, and the woman behind the legend she herself created", three years after the designer's death, that the truth began to trickle out.

In 1995 the French weekly L'Express uncovered more compromising testimony, which its German counterpart Der Spiegel added to in 2008.

But the veil was truly lifted in 2011 with the publication of "Sleeping With the Enemy" by the American Hal Vaughan.

'VICIOUS ANTI-SEMITE'

His biography, supported by documents from French, German, British, Italian and Polish archives, claims that Chanel was a "fanatical anti-Communist" and "a vicious anti-Semite".

"Hal Vaughan's book shows incontestable evidence that Mademoiselle Chanel seriously compromised herself with the Germans," Charles-Roux told AFP before her death in 2016.

But she insisted that Chanel never said anything anti-Semitic to her. "I wouldn't have put up with it," she added.

After Vaughan's book was published the Wertheimer family, who still own Chanel, denied the great designer was anti-Semitic.

And they argued that there was still "an element of mystery" about exactly what Coco did during the war.