England crashed to their first home test series defeat by Sri Lanka as the tourists claimed a thrilling victory off the penultimate ball at Headingley, ensuring that a valiant maiden century from Moeen Ali went unrewarded.
The England spinner's rearguard action with the bat had all but saved the final test of the two-match series, but the equally doughty resistance of last man James Andersen (0) was finally ended when he spooned a Shaminda Eranga bouncer to square leg to complete Sri Lanka's 100-run victory.
Having resumed on Tuesday at 57 for five, facing an unlikely victory target of 350, England made a positive start but lost Joe Root (31) and Matt Prior (10) in reaching 173 for seven by the interval.
Dhammika Prasad took his fifth wicket of the innings when he removed Prior, leaving left-hander Ali (108 not out) as England's best hope.
Though Ali batted all day, partners Chris Jordan (21) and Stuart Broad (0) were both trapped lbw by Rangana Herath before Anderson's hour-long resistance was ended at the death.
Earlier, perhaps frustrated by the lack of a breakthrough, Sri Lanka captain Angelo Mathews exchanged words with Root and umpire Billy Bowden was forced to intervene.
As the sledging continued Shaminda Eranga subjected Root to a feisty spell, troubling the 23-year-old with some fiery bouncers.
Root's defiance was finally ended when he edged Nuwan Pradeep to Lahiru Thirimanne in the gully, bringing an end to a 67-run partnership with Moeen for the sixth wicket.
The first test at Lord's ended in a draw after Englanded failed to take the last Sri Lankan wicket.