She was one of Hollywood’s most celebrated actresses. But Audrey Hepburn had a role that few knew about: spy.

And unlike the characters that she portrayed on screen, playing this part could literally mean life or death.

The maddeningly private actress, who died in 1993, had dropped hints about her work with the Dutch Resistance during World War II, and now a new book puts the whole story together, providing an in-depth look at her life during the conflict.

Robert Matzen, author of “Dutch Girl: Audrey Hepburn and World War II” (GoodKnight Books), combed secret files, talked to Hepburn’s family and tracked down diaries to uncover new information.

The biggest surprise to many will be Hepburn’s work with the Dutch Resistance against Nazi occupation. She certainly seemed an unlikely hero.

For starters, she was just 10 years old when World War II broke out. For another, her parents were infamously pro-fascist — though the realities of Nazi occupation would ultimately change her mother’s mind.

Hepburn was born in Belgium in 1929 to an upper-class family. Her father worked in finance, and her mother, Baroness Ella van Heemstra, was a Dutch noblewoman.

In 1935, her father walked out on the family and moved to London. The abandonment stung Hepburn.

‘My parents divorced when I was 10, and my father disappeared and all that. But we didn’t have any money at all.’

“I think it is hard sometimes for children who are dumped,” Hepburn would later say. “I don’t care who they are. It tortures a child beyond measure. They don’t know what the problem was. Children need two parents for their [emotional] equilibrium in life.”

Hepburn spent a few years at a posh private school near Dover, England, but with war brewing, her mother thought it best for her and her daughter to relocate to Holland. Hepburn left England for the Netherlands in December 1939 at age 10.

Despite Ella’s noble title, the family was not wealthy. The family’s grand ancestral home, where Hepburn’s grandfather lived, was rented.

“My mother didn’t have a dime,” Hepburn once said. “My parents divorced when I was 10, and my father disappeared and all that. But we didn’t have any money at all.”

Hepburn’s mother took a job selling furniture, and she and her daughter settled into a modest apartment in Arnhem, a city in eastern Holland.

Van Heemstra had been a supporter of the Nazis. She once wrote in a National Socialist newsletter, “Well may Adolf Hitler be proud of the rebirth of this great country and of the rejuvenation of the German spirit.”

She and her husband had even met privately with the Fuehrer in Munich in 1935.

Germany invaded the Netherlands in May 1940. Troops surged over the border, quickly occupying towns and villages.

Almost overnight, public signs were switched to German and swastika flags began flying.

“The first few months we didn’t know quite what had happened … I just went to school,” Hepburn would recall. “In the schools, the children learned their lessons in arithmetic with problems like this: ‘If 1,000 English bombers attack Berlin and 900 are shot down, how many will return to England?’ ”

Hepburn’s escape was dance. She had been introduced to ballet in England, and now she threw herself into it full force, deciding she wanted to become a professional ballerina. In 1940, she enrolled in a specialized school under a celebrated dance teacher.

She fell in love with the stage.

“The shy and withdrawn child who disappeared into the wall­paper in any social situation had transformed under the influence of dance and now sought only to express herself,” Matzen writes.

Relative normalcy was shattered in 1942 when Hepburn’s uncle, Otto van Limburg Stirum, was rounded up and imprisoned. He and four others were driven to a forest, tied to a stake and shot after being forced to dig their own graves.

The murder sent Hepburn’s mother fleeing to Velp, a small town where Hepburn’s grandfather lived.

The tragedy also completed Hepburn’s mother’s conversion away from Nazism, and she now actively pursued ways to help the Resistance.

The cruelties of war were everywhere. Hepburn in 1991 recalled witnessing a train being filled with Jews.

“I remember, very sharply, one little boy standing with his parents on the platform, very pale, very blond, wearing a coat that was much too big for him, and he stepped on the train,” she told a reporter. “I was a child observing a child … Then I realized what would have happened to him.”

In the summer of 1944, Hepburn began volunteering for Dr. Hendrik Visser ’t Hooft, a handsome, 39-year-old physician and former Olympian. It was here her ties to the underground Resistance were formed. Visser ’t Hooft was an anti-German leader, and the hospital where he worked was the center of the Resistance in the area, with doctors helping to forge identity documents to assist those in hiding.

One of Hepburn’s contributions was dance. She began performing at illegal, by-invitation-only nighttime events designed to raise money for the Resistance. These nights were called “zwarte avonden,” or “black evenings,” because the hosts were forced to black out the windows so as not to be discovered by the enemy.

“Guards were posted outside to let us know when Germans approached,” Hepburn would later say. “The best audiences I ever had made not a single sound at the end of my performance.”

The budding ballerina also delivered a Resistance newspaper, Oranjekrant. Because paper was in short supply, the newsletter was printed on a sheet half the size of a paper napkin.

“I stuffed them in my woolen socks in my wooden shoes, got on my bike and delivered them,” Hepburn would later recall.

And because Hepburn, having been educated in England, spoke English, she was tapped by Visser ’t Hooft to carry messages and food to downed Allied pilots in 1944. She was just a teenager, and still young enough to avoid suspicion from the police.

Hepburn’s family went as far as to harbor an English pilot shot down over the Netherlands, hiding him in the house, like Anne Frank. His presence brought the war home “to Audrey in a way a 15-year-old could never have expected,” the author writes.

According to Hepburn’s son, Luca Dotti, it was her favorite story to tell about the war.

‘My mother told me it was thrilling for her — it was risky, he was a stranger in uniform, a savior.’

“My mother told me it was thrilling for her — it was risky, he was a stranger in uniform, a savior, and therefore a knight and hero,” Dotti says in the book. “Then I learned about the German law that if you were caught hiding an enemy, the whole family would be taken away.”

It never came to that. It’s unclear how long the pilot stayed or what became of him, but he was never discovered by the Germans.

The war would still take a terrible toll on the teenage Hepburn and her family. They often survived without power, heat or water, and in the winter of 1944-45, food almost completely disappeared.

Hepburn would go as long as three days without eating, and for months breakfast was hot water and one slice of bread made from brown beans, with broth and a potato for lunch.

Her town was finally liberated by Allied troops in spring 1945. Hepburn and her family rushed from hiding in their house to discover soldiers pointing guns at them.

Hepburn blurted out some words in English, and the troops erupted in cheers, one crying, “Not only have we liberated a town, we have liberated an English girl!”

After the war, Hepburn continued to dance and found other ways to make money, including modeling. In 1948, she landed her first acting gig and was cast in a low-budget travelogue called “Nederlands in Zeven Lessen” (“Dutch in Seven Lessons”). A gamine Hepburn can be seen walking across a street and smiling at the camera. Because film stock was so expensive, the filmmakers simply used Hepburn’s audition in the finished movie.

The experience still didn’t diminish her passion for ballet, and she soon moved to London to study dance. Quickly, however, she discovered that at 5 feet 7, she was too tall to ever make it as a ballerina, and she turned to the stage.

She was cast as a dancer with a single line in a West End musical called “High Button Shoes.” More stage roles followed, and she was on her way.

When she arrived in New York in 1951 to star in Broadway’s “Gigi,” her mother was not with her.

Despite the family’s aid to the Resistance, van Heemstra was still eyed by some as a Nazi collaborator, as a result of her vocal prewar support.

Witnesses after the war testified that she had Nazi paraphernalia in her apartment and had associated with members of the secret police. She denied the charges, though the stain was enough for her to be refused entry to the United States.

The war was long over, but its consequences would follow Hepburn and her family forever.

“For all that she would become,” the author writes, “Academy Award-winning actress, Givenchy fashion plate and international jet setter so at home on the Riviera or in Rome or Paris, the war years remained all too close.

“The war was very, very important to her,” her son says in “Dutch Girl.” “It made her who she was.”