In 2006, Iran’s president tried to restore one small piece of the civil liberties the Islamic Republic had repressed since its 1979 revolution.

Then-President Mahmoud Ahmadinejad rescinded the decades-old ban on female spectators at men’s soccer matches. Iran’s religious leaders had argued that allowing women to see men play sports violated Muslim laws promoting piety. Ahmadinejad disagreed.

“The best stands should be allocated to women and families in the stadiums in which national and important matches are being held,” he said on state television. “The presence of women and families in public places promotes chastity.”

Supreme Leader Ayatollah Ali Khamenei reinstated the ban weeks later.

But Tuesday, for the first time in 35 years, according to Iranian state media, women were allowed to watch Iran’s national team, better known as Team Melli. The occasion was a friendly against Bolivia at Tehran’s Azadi Stadium.

Close to 100 women — employees of the Iranian federation and members of the women’s national team — sat in their own section and waved Iranian flags through near-constant cheering.

Soccer is Iran’s most popular spectator sport, with wrestling and volleyball not far behind. Team Melli, which literally means “the nation’s team,” enjoys tremendous support. Club teams attract crowds that rival those in Europe.

But since the revolution, women have been outlawed from watching those sports in person or in public places such as restaurants. The country’s largely secular populace has pushed back on that restriction as part of a political movement demanding more personal liberties, according to Alex Vatanka, a senior fellow at the Middle East Institute, a nonpartisan think tank. (Vatanka’s father played for the Iranian national soccer team before the revolution.)

Women have disguised themselves as men, with fake beards and mustaches, to gain entry to stadiums. Those who succeed have been cheered on as national trailblazers. Some business owners have risked fines or arrest to show national team games to mixed-gender crowds.

Hossein Mahini, a defender on Team Melli and popular club side Persepolis, tweeted a photo of the women in the stands after the match and wrote, “Hoping for a day that gives you [female fans] half of Azadi [Stadium].”

It marks a considerable moment for Iranian civil society, Vatakana said, after Team Melli’s strong showing in the World Cup.

“A young person looks at state news and hears the [Persian proxy fighters] are doing well in Syria, but for the average young, secular person, it’s hard to understand that as good news,” Vatanka said. “Going to these soccer matches, supporting your team, being mainstream at an international soccer tournament, it’s a way to say, we’re normal.”

But Iran’s political establishment made clear after the match that women will not be allowed into future sporting events. The country’s prosecutor general, Mohammad Jafar Montazeri, an unelected official who answers to the supreme leader, said he will order Tehran’s government to prosecute stadium officials who allow women into men’s sporting events.

“I object to the presence of women in Azadi Stadium yesterday. We are a Muslim state, we are Muslims,” Montazeri said, according to Agence France-Presse. “We will deal with any official who wants to allow women inside stadiums under any pretext. When a woman goes to a stadium and is faced with half-naked men in sports clothes and sees them it will lead to sin.”

Read more from The Post: