In the summer of 2017, a social-media movement was encouraging Iranian women to tear off their mandatory hijabs and share their moments of “stealthy freedom” online.

Girls were routinely rejecting the rules of “good hijab” by wearing their veils so loosely that strands of hair could escape. Women posted photos of themselves hiking or driving with their locks flowing free, using the hashtag #whitewednesday to show their contempt for Iran’s strict modesty laws.

“The veil was an ideological pillar of the revolution” that overthrew Iran’s shah in 1979, writes Kim Ghattas in “Black Wave” (Henry Holt), a history of that year’s twin regional crises — the Iranian Revolution and the siege of Mecca in Saudi Arabia — and the resulting tsunami of religious zealotry that flooded every corner of the Middle East.

For most of four decades, she writes, Iran’s required head covering has shrouded the entire nation, enforcing “a semblance of homogenous unity” aimed at keeping all its people, women and men alike, in line.

But that homogeneity is merely a façade, Ghattas writes.

In truth, Iranians have led double lives ever since Ayatollah Ruhollah Khomeini established his theocracy in 1979.

Publicly, nearly all of Iran’s 82 million citizens abide by strict rules banning music, alcohol and mixed-gender socializing. Women and girls are to keep their hair hidden at all times and are schooled to do so at home as well as in public.

But Iranians routinely break all those decrees in private.

“Life retreated indoors,” Ghattas explains. “There were still private parties where women and men danced together, everyone drank, and music played.”

This divide between the public and private has allowed Iranians to nurse a stubborn rebellious streak that has repeatedly burst free. Frustrations have often boiled over when the regime pushes beyond its borders in pursuit of a “Shia crescent” — an Iran-controlled empire stretching from its home territory, west through Iraq and Syria, all the way to Lebanon on the Mediterranean Sea.

‘What Iranian women wanted was the choice: to veil or not to veil’

Ghattas’ account of Iran’s split personality casts fresh light on the fierce protests that broke out repeatedly in 2019 — and on the continuing demonstrations in the aftermath of the United States’ targeted killing of Iranian Gen. Qassem Soleimani last month.

It was Soleimani who in 2017 tried to shame Iran’s bareheaded women back under their scarves. As commander of the Quds Force, he was in charge of the Iranian troops who fought for Syrian dictator Bashar al-Assad. The August 2017 capture and gruesome beheading of Iranian soldier Mohsen Hojaji by members of ISIS became a propaganda weapon in Soleimani’s hands.

At Hojaji’s public funeral, Soleimani ushered out the soldier’s widow, who told the country that her husband had lost his head so that dutiful Iranian women could cover theirs.

“I’m asking people, for the sake of a wife of a martyr, a mother of a martyr, a sister of a martyr, to keep their hijabs,” Zahra Abbasi urged the crowd of mourners.

It echoed a tactic that Khomeini himself deployed in 1979, in his revolution’s earliest months, when he first faced pushback against his new theocracy.

Four days after Khomeini returned to Iran from years of exile, he declared any opposition to be blasphemy.

“I will decide the government, a government for the people,” he intoned. “Revolt against God’s government is revolt against God.”

Music, banned from radio and television, was “no different from opium,” the ayatollah decided. When he outlawed alcohol, troops from the Islamic Revolutionary Guard Corps (IRGC) seized more than a million dollars’ worth of imported wine and beer from Tehran’s Intercontinental Hotel and poured it into the gutter. It was a methodical, highly organized purging of all Western influence, a return to the medieval roots of Islam.

The campaign met with little public resistance — until Khomeini brought the hammer down on Iran’s women.

On March 6, 1979, he issued a new rule: “naked women” — that is, women who did not hide their hair beneath a veil — were banned from government offices. The rule did not make the hijab mandatory for all, but the nation’s women knew that eventually it would. They had won the right to dress as they wished during the previous rule of Shah Mohammad Reza Pahlavi, and they had no intention of losing it.

“In the dawn of freedom, there is an absence of freedom,” they shouted through six days of mass demonstrations that drew crowds of up to 100,000 — some veiled, some bareheaded.

“What Iranian women wanted was the choice: to veil or not to veil,” Ghattas writes.

In response, Khomeini’s state-run media launched a shame campaign. The protesters were cast as monarchists fighting not for their personal freedom, but for the return of Pahlavi.

“The movement was racked with doubt,” Ghattas writes — were they really being used by the shah’s secret supporters to undermine the revolution? “The protests petered out.”

Now, forty years after the revolution, a new generation of Iranians is seizing the old tradition of anti-government protest. By 2017, “many Iranians were tiring of the attention to causes that were not their own,” Ghattas writes. “Their pockets were still empty. But the regime was still spending blood and money in Iraq and Syria.”

Those conditions only worsened in 2019, as US sanctions hammered Iran’s economy, forcing sharp price increases for gas and other essentials. Internet shutdowns were not enough to thwart the nationwide demonstrations. The response from Soleimani’s troops was brutal: At least 1,500 Iranians died.

But, in the face of their violence, the pace of anti-regime protests only quickened. Observers have logged more than 4,000 separate demonstrations in the last two years.

And Iranian women’s continuous acts of defiance against the veil have been the heat beneath that bubbling pot.

“Every day we see new videos of women challenging the morality police,” refusing orders to cover their heads as they walk on the street or ride public transportation — even though hundreds have been arrested and imprisoned for breaking the modesty law. Ghattas said.

The veil protests “are the most difficult thing for the regime to contend with, because they are being done as isolated occurrences.”

In last month’s demonstrations against Iran’s shoot-down of Ukraine Airlines Flight 752, dozens of bareheaded female students could be seen mingling with peers under headscarves.

“The protests against the veil have become interconnected with protests against government corruption, mismanagement, and now the downing of the Ukrainian plane,” Ghattas said. “It’s a war of attrition and it really has the authorities scared.”

Ghattas is reluctant to predict what may happen next as Iran’s regime clings to power. “But I think something is coming undone throughout the Middle East, and it has to do with the legacy of 1979,” she said. “The younger generation does not want to be held hostage to that year anymore.”