For Iranians, their football team's World Cup loss against the United States was cause for either sadness or exuberant joy, depending on where they stand on a two-month-old protest movement.
Caught between the clerical regime and calls to show solidarity with protesters, the national team pressed near-relentlessly in the second half on Tuesday night but were unable to cancel out a 38th minute opener by the US, resulting in an early exit.
That prompted the extraordinary spectacle of Iranians cheering a defeat inflicted by the Islamic republic's arch-enemy often labelled the "Great Satan".
"Who would've ever thought I'd jump three metres and celebrate America's goal!" tweeted Iranian gaming journalist Saeed Zafarany.
PAY ATTENTION: Subscribe to Digital Talk newsletter to receive must-know business stories and succeed BIG!
Inside Iran, celebrations were especially marked in western Kurdistan province, the cradle of a movement sparked by the death of young Kurdish woman Mahsa Amini in morality police custody after her arrest for allegedly infringing the nation's strict dress code for women.
A video shared online by Kurdish activist Kaveh Ghoreishi showed a Sanandaj city neighbourhood at night with sounds of cheering and horns blaring after the United States scored.
That goal also prompted joy in Amini's hometown of Saqez, according to the London-based news website Iran Wire, which published images showing fireworks and sounds of people cheering.
Protesters also set off fireworks in Mahabad, Kurdistan, following Iran's loss, according to videos shared online, while Norway-based Hengaw human rights group also reported celebrations there and in the city of Marivan.
The scenes of joy were not confined to Kurdistan province, reflecting the nationwide nature of the protest movement.
Videos on social media showed citizens celebrating in the capital Tehran and Ardabil, Mashhad, Kerman and Zahedan
many with people dancing and cheering in the streets amid long traffic jams.
It was a very different story in a hall in Tehran, where hundreds gathered to unreservedly cheer on their team -- including women, in a country where they often have difficulty accessing stadiums.
"I'm so sad that Iran couldn't defeat the USA but anyway we are proud of our national team and its players," said Ali, a retiree. "They did their best and we are not angry with them."
In Qatar itself, supporters of the US and Iran mingled cordially before the crunch game.
Crowds with the Stars and Stripes and the red, green and white colours of Iran's flag talked largely freely as they entered Al Thumama Stadium.
Inside the ground, female Iranian fans sat -- and often stood -- proudly cheering their team without headscarves, some with the national flag daubed on their faces.
'Woman, life, freedom'
Iran's players, after refusing to sing the national anthem for their opening game against England in a gesture of solidarity with the protests, reversed that stance for their second game with Wales, resulting in opprobrium in some quarters.
Players again voiced the anthem, albeit with little enthusiasm, for what turned out to be Iran's final game.
They now go home to a country that remains on edge, as authorities crack down on the mainly peaceful protests that have become the biggest challenge to the regime since its birth in 1979.
After Iran's victory over Wales, the judiciary announced the release of more than 1,100 detainees, including protesters, among them former national goalkeeper Parviz Boroumand.
Emblematic of the divisions, an AFP video showed scuffles breaking out among pro- and anti-regime Iranians outside the stadium after the US match.
The footage showed a woman wearing a T-shirt with the protest slogan "Woman, life, freedom" being harassed by Iranian men as she gave a televised interview.
A Danish journalist said he was briefly detained after filming pro-regime fans attacking supporters of the Iranian protest movement.
Rasmus Tantholdt of TV2 Denmark tweeted that Qatari security forces had instructed him to erase the footage but he refused to do so.
Iranian supporters have had run-ins with security for sporting clothing bearing images of Amini or the words "Woman, life, freedom" in Qatar which, unlike most other Gulf states, maintains cordial relations with Tehran.
Iran says more than 300 people have been killed since the protests erupted, but Oslo-based group Iran Human Rights says at least 448 people have been killed by the security forces in the ongoing protest crackdown.