Sri Lanka won when they had almost abandoned hope. From the penultimate ball of a gripping final day, Shaminda Eranga found a hostile delivery to bring their first series win in England. James Anderson, who could only fend it to the leg side in self-preservation, dropped to his haunches in despair. Moeen Ali's immense maiden Test century was briefly forgotten, submerged beneath an ecstatic Sri Lankan celebration.
An indomitable backs-to-the-wall display by Moeen had come so close to sparing England: an unbeaten 108, unblemished even, made from 281 balls. England's last five wickets had clung on for all but two balls of the final day. Pride had been salvaged, perhaps a captain had been spared too, but it is Sri Lanka who can celebrate a special moment in their Test history.
Sri Lanka's last pair held out for five balls in the first Test at Lord's. This time the task was much harder for Moeen and Anderson: 20.2 overs. Even in Cardiff, when Anderson and Monty Panesar famously held off Australia in 2009, they only saw out 11.3. This time Anderson summoned a heroic 55-ball nought, all signifying nothing.
Tension slowly seeped into the final day as it only can in Test cricket. The crowd was sparse - Yorkshire had folded its arms in condemnation, convinced like all but the most incorrigibly optimistic that England's abject collapse to 57 for 5, well adrift of a target of 350, had sealed their fate - but a night's sleep had cleared muddled heads and Headingley, treacherous Headingley, not the sort of pitch to turn your back on, behaved like an old softie. At only a fiver entrance fee for the final day, Yorkshire had turned its back on a classic.
Moeen, a cricketing free spirit, played with such judgment and self-denial that he must have explored parts of himself never visited before. He surely surprised even himself, suppressing the silky ambition of his batting during a strikingly unselfish innings in which his most positive shots were expertly selected. He met the second new ball with conviction and, in only his second Test, he made light of his international experience with impassioned advice to England's tail.
Only with nine wickets down did Moeen seek to steal the strike, only now did his timing begin to go awry as the demands weighed upon him. But his concentration was unwavering. His century came with half-an-hour remaining, flicking Nuwan Pradeep off his pads, but it had always felt like an afterthought in an innings where he appeared entirely consumed by England's survival. This was not as much an innings as personal growth before your eyes.
Even in defeat, there should be no doubt who will be the recipient of England's annual Beard of the Year award - and, if that is one of the most frivolous awards around, this time it would have a more serious message. There are times when the wider social impact of a performance in sport must also be recognised even in a match report - and this was one of them.
A sole spectator earlier in the Test who observed, however unthinkingly, that Moeen's beard suggested he should be blowing up buildings was rightly reported to stewards and warned. Muslim cricketers have played for England before, but none had been so visibly proud to be a role model. With every stout-hearted block, Moeen made such comments appear ever more ignorant and, for those who questioned as much, integrated himself - and more importantly his beard - deep into the fabric of the England side.
There were two umpiring reviews for Moeen to survive along the way, both optimistically sought by Sri Lanka for leg-side catches. On 52, a delivery from Rangana Herath, the left-arm spinner, found its way to leg slip, on 71 Eranga flicked his thigh pad on the way through to the wicketkeeper, but he was confident that his survival chances were 100%.
Such was his selectivity that it was hard to recall another blemish. On another occasion, he had an inadvisable flirt when Herath slanted a low-arm delivery across him, but generally he curbed his attacking instincts with great resolve, only occasionally allowing himself to sweep or come down the pitch to Herath, choices he made with impeccable judgment.
England set the tone for the final day by making only 26 in nearly 18 overs during a drizzle-interrupted morning. Root clearly relished the chance to produce an innings of Boycottian bloody-mindedness in front of the Yorkshire crowd; strokelessness is no hardship for him when the match dictates it.
Not shy of a word or two himself - the innocent countenance is misleading - he became the victim of prolonged sledging from the Sri Lanka captain, Angelo Mathews, who was instructed to curb his behaviour more than once by both umpires, and whose victory celebrations looked bound to be interrupted by an audience with the match referee. He should offer him an arrack and see if he can get away with it.
If Mathews was in danger of getting sidetracked, it did not show in his captaincy, which remained well judged. He shuffled his bowlers endlessly in the final hour to try to unsettle England's last pair and it paid off when he flung the ball to his most aggressive bowler, Eranga for one last effort - although not before he kept Mooen off strike with his own excellent over.
Sri Lanka's bowlers, by and large, were disciplined as the wickets came only slowly. Eranga adopted a short-ball policy in mid-afternoon, but it seemed a legitimate tactic at the time and unsettled Root. Herath lobbed up over after over accurately, but found little turn. Instead Root was unpicked by an outswinger from Pradeep, a leading edge flying low to gully where Lahiru Thirimanne held a smart catch.
Prior became a fifth victim for Sri Lanka's fourth-day hero, Dhammika Prasad, a well-directed ball into his body and a deflection which was expertly snapped up by Kaushal Silva low down at short leg - not the first time he has fallen in such a fashion.
It was Prasad's effort ball and it almost resulted in his first no-ball of the match - the TV umpire requiring innumerable replays before concluding, fairly enough, that he got a sliver of boot behind a wonky front line. The match referee, Andy Pycroft, was quick to advise that if there was any uncertainty - and there was uncertainty - the decision should rest with the bowler as there was not definite proof he had overstepped.
That decision, as it happened, was balanced out early in the final session. With the second over of the new ball, Chris Jordan drove loosely at Eranga and edged to second slip, only for another hair's breadth decision this time to fall in England's favour; again legitimately so.
There was further encouragement for Sri Lanka when a delivery from Pradeep went through the top and jagged alarmingly away from Jordan. Herath was reintroduced with the new ball seven overs old and he removed Jordan lbw with his second delivery. England's review had an air of desperation.
Indifferent light became Sri Lanka's next problem as the emergence of a blinking Stuart Broad coincided with the first appearance of the umpires' light meters. Sri Lanka were forced to resort to Mahela Jayawardene's little-used offspin - six wickets to his name in 145 Tests - but, while the restrictions were in operation, Broad's 24-ball nought ended when Herath straightened one to have him lbw.
Sri Lanka's recovery had been admirable - England had been 311 for 3 in their first innings at one stage, ahead by 54 - and over-excitability was the only explanation for wasting their second review, with 16 overs remaining, a futile search for an lbw decision for Herath against Anderson. Over-excitability became concern, became desperation, before desperation - at the last - was transformed into utter delight.