Wales' first World Cup for 64 years looks set to end at the first hurdle after they suffered a heartbreaking - but deserved - last-ditch defeat against Iran in Qatar.
Substitute Rouzbeh Cheshmi struck from 20 yards deep into added time, before Ramin Rezaeian finished off a counter-attack to seal victory for a revitalised Iran side who have renewed hope of reaching the knockout stages for the first time in their history.
As they did in their opening draw with the United States, Wales started poorly and had VAR to thank for disallowing a goal from Iran's Ali Gholizadeh for offside.
In one of the most highly-charged atmospheres of this World Cup, Iran's players sang their anthem this time - having refused to do so before their opening loss to England in an apparent show of support for anti-government protests in their country - but their own fans booed the anthem and some could be seen crying in the stands.
Roared on by the fervent and almost entirely Iranian crowd, Carlos Queiroz's side were extremely unlucky not to score early in the second half as Sardar Azmoun and Gholizadeh both struck the post within the space of a few seconds.
Wales were utterly ragged and, as they pushed forward in search of the late winning goal they desperately needed, a long ball over the top left the defence exposed and their onrushing goalkeeper Wayne Hennessey was sent off - after a VAR check - for a reckless challenge on Mehdi Taremi.
That set the seal on Wales' fate for this match and, in all likelihood, their hopes of reaching the second round.
While Robert Page's men were just as disjointed as they were against the USA, Iran were unrecognisable from the team thrashed 6-2 by England in their first match and fully deserved this win which breathes new life into their ambitions of progressing to the last 16.
Wales now face the formidable challenge of needing to win their final group match on Tuesday against England, who take on the United States later on Friday.
It is not impossible but, based on how the Group B teams have fared so far in Qatar, Wales' first World Cup for 64 years looks like it is in serious danger of ending at the earliest stage.Wayne Hennessey's red card was the first at this World Cup
Wales rue another sloppy performance
Having been absent from World Cups since 1958, Wales marked their emotional and long-awaited return to football's grandest stage with a 1-1 draw against the United States at the same stadium on Monday.
They seemed overawed by the magnitude of that occasion during a first half in which they were overrun and outplayed by the USA, but were much improved after the half-time introduction of Kieffer Moore.
The Bournemouth striker started this time and, while his presence gave Wales an added dimension in attack, they were still as worryingly porous in midfield as they had been against the States.
Iran sensed that weakness and pressed their opponents high up the pitch, prompting panic among Welsh midfielders and defenders, particularly on the break.
Despite their vulnerability through the middle, where Page had stuck with the same selection, Wales looked more dangerous when they played with width, and it was Moore who stood to benefit.
Connor Roberts found the 6ft 5in forward with a fine cross from the right in the 13th minute and, although Moore stretched to connect with a volley, it was straight at goalkeeper Hossein Hosseini.
Roberts' next involvement three minutes later was less distinguished as his cross-field pass was cut out near his own penalty area and allowed Sardar Azmoun to tee up Gholizadeh to finish into an empty net. There was no flag at first but, after a swift VAR check, the goal was disallowed for offside.
Azmoun himself headed the next chance over as Wales struggled to get a hold of the game. Fortunately for them, as energetic and well-drilled as Iran were, they did not create much in the way of genuine scoring opportunities.
More to follow.
How to play
Rate players out of 10 throughout or after the game. The rater will close 30 minutes after the final whistle.
Rating range key1 = Give it up10 = Pure perfection
Squad number1Player nameHennessey
Squad number5Player nameMepham
Squad number6Player nameRodon
Squad number4Player nameDavies
Squad number14Player nameRoberts
Squad number10Player nameRamsey
Squad number15Player nameAmpadu
Squad number8Player nameWilson
Squad number3Player nameN Williams
Squad number11Player nameBale
Squad number13Player nameMoore
Squad number7Player nameAllen
Squad number9Player nameJohnson
Squad number12Player nameWard
Squad number20Player nameJames
Squad number24Player nameHosseini
Squad number23Player nameRezaeian
Squad number19Player nameHosseini
Squad number8Player namePouraliganji
Squad number5Player nameMohammadi
Squad number17Player nameGholizadeh
Squad number6Player nameEzatolahi
Squad number21Player nameNoorollahi
Squad number3Player nameHajisafi
Squad number9Player nameTaremi
Squad number20Player nameAzmoun
Squad number7Player nameJahanbakhsh
Squad number10Player nameAnsarifard
Squad number15Player nameCheshmi
Squad number16Player nameTorabi
Squad number18Player nameKarimi
Formation 3-5-21HennesseyBooked at 86mins5Mepham6RodonBooked at 45mins4Davies14RobertsSubstituted forJohnsonat 57'minutes10RamseySubstituted forWardat 87'minutes15AmpaduSubstituted forAllenat 77'minutes8WilsonSubstituted forJamesat 58'minutes3N Williams11Bale13Moore
Formation 4-4-1-124Hosseini23RezaeianBooked at 90mins19Hosseini8Pouraliganji5Mohammadi17GholizadehSubstituted forJahanbakhshat 77'minutesBooked at 90mins6EzatolahiSubstituted forKarimiat 83'minutes21NoorollahiSubstituted forCheshmiat 78'minutes3HajisafiSubstituted forTorabiat 77'minutes9Taremi20AzmounSubstituted forAnsarifardat 68'minutes
Match ends, Wales 0, IR Iran 2.
Second Half ends, Wales 0, IR Iran 2.
Goal! Wales 0, IR Iran 2. Ramin Rezaeian (IR Iran) right footed shot from the centre of the box to the centre of the goal. Assisted by Mehdi Taremi following a fast break.
Goal! Wales 0, IR Iran 1. Roozbeh Cheshmi (IR Iran) right footed shot from outside the box to the bottom right corner.
Attempt blocked. Alireza Jahanbakhsh (IR Iran) right footed shot from outside the box is blocked. Assisted by Morteza Pouraliganji.
Attempt blocked. Alireza Jahanbakhsh (IR Iran) right footed shot from outside the box is blocked. Assisted by Mehdi Torabi.
Attempt blocked. Ramin Rezaeian (IR Iran) right footed shot from outside the box is blocked. Assisted by Mehdi Taremi.
Attempt missed. Brennan Johnson (Wales) right footed shot from a difficult angle on the right is close, but misses to the right. Assisted by Neco Williams.
Attempt missed. Neco Williams (Wales) right footed shot from outside the box misses to the right.
Alireza Jahanbakhsh (IR Iran) is shown the yellow card for a bad foul.
Chris Mepham (Wales) wins a free kick in the defensive half.
Foul by Alireza Jahanbakhsh (IR Iran).
Ramin Rezaeian (IR Iran) is shown the yellow card.
Dan James (Wales) wins a free kick on the left wing.
Foul by Ali Karimi (IR Iran).
Offside, IR Iran. Alireza Jahanbakhsh tries a through ball, but Karim Ansarifard is caught offside.
Kieffer Moore (Wales) wins a free kick in the defensive half.
Foul by Majid Hosseini (IR Iran).
Attempt missed. Mehdi Torabi (IR Iran) right footed shot from outside the box is high and wide to the right. Assisted by Karim Ansarifard.
Attempt missed. Karim Ansarifard (IR Iran) right footed shot from outside the box misses to the left. Assisted by Mehdi Taremi.
Get your daily dose of Fifa World Cup reaction, debate & analysis with World Cup Daily on BBC Sounds