Her code name was “Hedgehog,” an homage to a “tough animal that even a lion would hesitate to bite,” as a friend once said.

And like a hedgehog, which appears cute and nonthreatening but can roll into a tight ball deploying dangerous quills when challenged, Marie-Madeleine Fourcade had an unexpected tough side.

The young French woman headed one of the most important resistance networks during World War II and oversaw the collection of crucial intelligence that helped turn the battle’s tide. And yet she remains virtually unknown — in large part, because of her gender.

“Nobody really remembers her, and one of the main reasons is she’s a woman,” author Lynne Olson tells The Post.

Olson’s new book, “Madame Fourcade’s Secret War: The Daring Young Woman Who Led France’s Largest Spy Network Against Hitler” (Random House), aims to give due to someone who has gotten little.

“The idea of a woman doing what she did, facing down all these men, breaking every rule in the book about how you should behave as a woman, it’s just really incredible,” Olson says.

And Fourcade did it in a patriarchal society where, before World War II, women were still not allowed to vote or own property in their name.

In 1941, Fourcade ascended to command a vast intelligence network in France, overseeing some 3,000 agents and operating in nearly every sizeable town in the country.

She was just 31.

The group’s name was the Alliance, but the Nazis called it Noah’s Ark, because its members used animal code names.

The Alliance and its spies risked their lives collecting information about German troop movements, gun placements, submarine sailing schedules and weapons development that was then relayed to the British.

The woman at its helm could not have been more unlikely.

Fourcade was born into a wealthy French family in 1909 and grew up in China. Her father worked for a shipping company and had been assigned to Shanghai.

From a young age, Fourcade had a love of adventure and enjoyed exploring the chaotic Shanghai streets bustling with beggars, fortune tellers and vendors.

Her father died suddenly of a tropical disease in 1917, and the family moved back to France, but living abroad had already made young Marie-Madeleine different from other French girls.

“She never operated according to society’s rules; she followed her own rules,” a longtime acquaintance says in the book. “Basically, she acted like a man.”

At 17, she met an army officer, and they quickly married. Two children followed: Christian, a year after the wedding, and two years later, Beatrice.

Fourcade soon chafed in the marriage, as her husband demanded she follow a more traditional role. They split in 1933.

In 1935, she did something that few women of her social class would do: She got a job, working as a producer at a Paris radio station.

Through French society connections, she would meet Georges Loustaunau-Lacau, a French military officer who was known by his nickname, “Navarre.”

Soon after meeting Fourcade in 1936, Navarre asked the young woman if she would help with a secret mission. He was launching a journal aimed at opening French eyes to German aggression, and he wanted Fourcade to travel to Belgium to retrieve sensitive documents detailing German intentions in Europe.

Fourcade agreed; her overseas upbringing may have instilled a particular pride in her nation.

“If you’re raised not in your country, you’re raised with this love of an ideal,” Olson says. “She was raised with this love of France as an ideal, of liberty, equality, paternity. And the idea that Hitler would come in and destroy everything she held dear about her country outraged her.”

She and Navarre were soon working to build a network of informers across Europe, and when Germany invaded France in 1940, the group moved completely underground.

In 1942, Navarre was arrested, leaving Fourcade in charge of the network. In order to ensure the continued assistance of British intelligence, which had been providing money and supplies, Fourcade decided to travel to Spain to meet a MI6 representative.

To meet her contact, Fourcade had to be smuggled across the border hidden in a small jute mail sack stuffed into the trunk of an accomplice’s car. She had to contort her 5-foot-6 body into a 2-by-4 bag and remain inside for more than nine hours, in excruciating pain the whole way.

When they reached Spain and she was released, she fainted. Her accomplice revived her in the most French way possible: with a cigarette and a glass of cognac.

When she met the MI6 man, he was in disbelief that the beautiful, elegant blonde standing in front of him was the Alliance’s leader.

“This is a joke, isn’t it?” the Brit asked.

Nonetheless, the English agreed to continue aid.

Over the next months, Fourcade and her network gathered vital intelligence across France and radioed it back to London. The work was incredibly risky because the Germans were furiously searching for spies and had dozens of clerks bunkered in a secret headquarters looking for suspicious radio transmissions. The Nazis could often pinpoint a signal to the exact apartment whence it came.

Further putting her network in danger was the fact that few of its members were trained spies. They were ordinary citizens who had little training and often made mistakes that compromised themselves or the network. Hundreds were captured or killed.

Fourcade managed to survive, in part, by moving around the country frequently and staying one step ahead of the enemy.

“She developed a sixth sense of when she and others were in danger,” Olson says. “Several times during the war, she would have this sense that the Gestapo were about to raid her headquarters and she’d get out. And, sure enough, the next day, the Gestapo were there.”

Another reason she evaded capture was that, in the early years at least, the Germans did not have much imagination when it came to women’s roles.

“Coming from a traditional, conservative society themselves, the Germans saw women chiefly in their conventional domestic roles as wives and mothers and . . . rarely suspected them of being spies or saboteurs,” Olson writes.

Fourcade’s luck nearly ran out when she was captured after German soldiers burst into her Aix safe house.

She was taken to a nearby barracks and imprisoned. She considered suicide by swallowing a cyanide pill she had hidden among her things, but instead pulled off a daring escape.

At 3 a.m, she stripped naked and somehow squeezed through the bars on the window, badly bruising her face and body. She dropped to the street below and evaded German patrols by hiding inside a crypt at a nearby cemetery.

One mental toll of her work was that she went without seeing her children for months or years. For safety, they had been put in the care of others, and Fourcade thought it too dangerous to meet them in person.

On one particular day, Fourcade asked a caretaker to walk her children past the house where she was hiding, as she watched tearfully from a window.

“I had the feeling of being buried alive,” Fourcade later recalled.

Fourcade’s work continued until the final days of the war, and as the Allies liberated the country in August 1944, she was in a small village in the northeast of the country. The residents were “mad with joy, drinking, laughing, dancing and singing,” Olson writes.

‘She developed a sixth sense of when she and others were in danger’ - Lynne Olson

A few weeks later, Fourcade returned to Paris, where a throng of British military officials and diplomats gathered at the Alliance headquarters on the Champs-Élysées and presented her with the Order of the British Empire, one of the government’s highest honors.

Fourcade was so overcome with emotion that she couldn’t speak.

When the British asked how they could repay her, she requested that they bring her children back from Switzerland, where they had been in hiding.

She was reunited with them, and then, in 1946, she married a French businessman, and three years later, they had a daughter.

Postwar, Fourcade worked to return the bodies of Alliance operatives killed in Germany, and she used her fortune to pay for scholarships for the children of the fallen.

She and some of the agents who survived would meet almost monthly in Paris thereafter. She died in 1989, at age 79, and was the first woman to be given a funeral at Paris’ Les Invalides, a complex celebrating France’s military history.

Olson says there’s a lesson for us all in Fourcade’s story.

“These agents were housewives and schoolteachers and bus drivers who were risking their lives every day because they wanted to save their country,” she says.

“If you see something going on that’s a threat to liberty, you, as an ordinary person, can do something about it. I think that’s really important to get across.”