Female soccer fans in Iran were taken through a roller coaster of emotions on Wednesday — and all before their team stepped onto the field to play Spain. 

For 38 years, women have been banned from watching men's sporting events in Iran. But on Tuesday, local news agencies in Iran reported that women would be allowed to watch a live broadcast at Tehran’s Azadi Stadium of Iran's World Cup match against Spain, taking place in Russia the next day. Then, just hours before the doors were set to open, authorities canceled the event. 

“Tonight’s match between Iran and Spain will not be broadcast at Azadi Stadium today due to infrastructure difficulties,” Iran's Tasnim news agency wrote less than three hours before kickoff. “Since there will be no public broadcast, it is respectfully asked from our dear nationals to avoid going to Azadi Stadium.”

Many fans turned up at the stadium anyway. On Twitter, photos and videos were posted of Iranians sitting, standing and playing vuvuzelas (the plastic horns made famous at the 2010 World Cup in South Africa) in protest. Decked out with Iranian flags, headscarves and other paraphernalia, both female and male soccer fans stared down a row of police blocking the entrance to the stadium.

Finally, after about an hour, the police gave way. The stadium gates were opened, and men, women and children who had bought tickets filed in, whipping out their phones and selfie sticks to capture a piece of history. Moments later, the official account of Iran's national team tweeted a picture of a female fan in the stands of Azadi Stadium holding up an Iranian flag. “Azadi Stadium, now!” the tweet said in Farsi.

Iran’s ban on women watching men’s sporting events has long sparked protests, but it became the subject of heated debate in the lead-up to the World Cup.

Earlier this year, Iran publicly reinforced the ban, which was introduced by Iran’s ruling clerics after the 1979 Islamic revolution. In March, 35 women attempting to sneak into Azadi Stadium for a match between two Tehran clubs were detained by authorities. A day later, FIFA President Gianni Infantino, who was present at the match, told reporters that Iranian President Hassan Rouhani had “promised that women in Iran will have access to football stadiums soon.”

On Friday, Iranian female fans frustrated by the ban took to the stadiums in St. Petersburg in the first of such protests in the tournament's history. 

With women finally having entered Azadi Stadium for the first time since the ban, they are hoping that the rules for watching sporting events in Iran will be changed permanently.

“Once spectators have shown their respect for the rules, we hope it will be possible to screen the Iran-Portugal game in the same stadium [next Monday] and that will mark the start of families attending matches played at the Azadi,” Tayebeh Siavoshi, a female member of Iran's parliament, told the Iranian Students' News Agency.

Yeganeh Rezaian, a 34-year-old Iranian journalist living in the United States, also was optimistic. Rezaian, who recently wrote about the lack of rights for female soccer fans in Iran, watched the 2014 World Cup in a dark coffee shop in Tehran, with the doors locked and the volume muted. (Rezaian's husband is a Washington Post columnist.)

“If we do it once . . . we can keep pushing for more. I really, really hope it happens,” Rezaian said, her voice choking up with emotion.

Erin Cunningham in Istanbul contributed to this report.