Sri Lanka have the whip hand in the second Test, the match turned on its head and all but won now by a brilliant, selfless hundred from their captain Angelo Mathews, his second of the series, sure to enter the annals as one of the greatest for his country, and a beautiful spell of swing and seam bowling from Dhammika Prasad that had England tottering on the ropes.

So effectively did Mathews marshall the lower order that by the time Jimmy Anderson yorked the last man to end the innings, England were facing 350 to win and a minimum of 118 overs in which to get them. A first-wicket partnership of 39 saw England on the way but Prasad then removed Alastair Cook, Gary Ballance and Sam Robson in eight balls. He then added the wicket of Ian Bell, had Liam Plunkett and Joe Root given out by Billy Bowden, only for the decisions to be overturned on review, and had Plunkett dropped at second slip.

It might have been a different pitch from that on which Sri Lanka had just made 457 in their second innings. The way in which Plunkett, as nightwatchman, lobbed Rangana Herath gently to extra cover in the last over was merely the cherry on a cake iced with embarrassment. England finished red-faced on 57 for five, a dismal performance from the start of the day to the end of it. Prasad has four for 15 and a smile as wide as Yorkshire.

Even at the outset the challenge facing England involved them heading into some uncharted territory, certainly in terms of winning. Only 10 times have England made as many as this, or more, in the fourth innings of a Test anywhere, three times only to draw, never to win, and only once in this country, in 1997, when they made 369 for 6 against India at The Oval.

To find their highest fourth-innings winning score, it is necessary to go back almost 86 years, when they made 332 for seven in Melbourne, one of only three occasions in which they have exceeded 300 to win a Test.

The only one of these in England came in 2001, against Australia on this ground. Adam Gilchrist, in the absence of the injured Steve Waugh and in what must have been a moment of frivolity, set England 315 to win with plenty of time and saw Mark Butcher, in the innings of his life, make an unbeaten 173.

The psychology of cricket is a major factor at the top level, however. Break even the most daunting target into segments and it seems less so. Get a good start in the final session and, with all wickets in hand next day, it can look an entirely different prospect. So it was always going to be a testing period for Cook and Robson, and important for England not just that they got through it but did so with an element of confidence. They played well enough in the early overs. Then Mathews brought on Prasad from the Kirkstall Lane end and immediately England were thrown back.

Prasad is not a tall bowler but skiddy instead. His second ball was back of a length but not unduly short and certainly not sufficiently so for Cook to try to pull. He did, though, the ball skidded through at him and the bottom edge demolished his stumps. The next ball Ballance got a glimpse into the future, for his technique – back and then further back in his trigger movement – means that bowlers who can swing the ball will unfailingly target his pads. Prasad was spot-on and Ballance was gone.

Six balls later and it was Robson, driving at a ball well pitched up outside off- stump, who was taken joyously at second slip by Mahela Jayawardene. The ball that bowled Bell pitched on a good length, a pristine area unsullied by the England bowlers, and nipped back to clip the top of off-stump.

Plunkett’s last-ball brainstorm means that England need 293 more runs on the final day. They can break that down into as many bite-sized chunks as they like, they do not have a hope in hell even of surviving. Nor do they deserve to.

The Sri Lanka recovery was wonderfully engineered by Mathews, whom England, to their detriment, and for reasons best known to themselves, pretty much ignored so intent were they on trying to dismiss the batsmen at the other end. When Anderson removed Jayawardene, and Plunkett then got the wickets of Dinesh Chandimal and Prasad with successive balls, Sri Lanka were 277 for seven, only 169 ahead. At that stage Mathews had 54. He was to finish with 160, having added 149 for the eighth wicket with Herath.

That this innings was worth 200 is no exaggeration for he must have conceded 40 runs in those not taken to a field set invitingly deep. He and Herath were together for 37 overs, 223 deliveries in fact, of which Herath faced 82 for his 48. England’s bowling degenerated into thrash-it-in-and-hope, as bad as it gets. Stuart Broad looks far from fully fit. Plunkett, excellent in the first innings, was a one-trick pony second time around.

And Anderson, brilliant at Lord’s, was way short of the mark here.In not giving more attention to Mathews, who is a good player but not that good, and in employing the methods they did, they let themselves down. Prasad taught them a real lesson.