Pakistan leapfrogged England in the World Cup standings as Imad Wasim’s 49 not out steered the 1992 champions to a thrilling three-wicket win over Afghanistan at Headingley.

Pakistan had lurched from 121 for three to 156 for six in pursuit of 228 on a dry track offering plenty of turn but Imad, fortunate not to given out on one, held his nerve to get his side over the line with two balls to spare.

Sarfaraz Ahmed’s side therefore move into the top four of the standings but England could move back above them if they defeat India at Edgbaston on Sunday.

Thirty-eight of Afghanistan’s overs came from their turners but Pakistan just about held their nerve to overhaul their Asian neighbours’ 227 for nine, after which followed a minor pitch invasion.

There seemed to some unsavoury clashes between rival supporters as the match wound to a close, hours after the International Cricket Council announced it was investigating “scuffles among a minority of fans”.

Nevertheless, the majority contributed to a carnival atmosphere full of horns blaring, drums banging and a cacophony of cheers.

Pakistan’s chase began in inauspicious circumstances as Fakhar Zaman burned a review attempting to overturn an lbw decision given against him first ball off Mujeeb Ur Rahman.

If Fakhar’s golden duck sent shivers through the dressing room, it was not immediately apparent as Imam-ul-Haq was joined by in-form Babar Azam, the pair interspersing hard running with some timely boundaries.

But Mohammad Nabi shifted the momentum by removing the twin pillars, a frustrated Imam advancing down the track only to york himself and be stumped for 36 while Babar’s 45 was ended after being bowled round his legs.

Babar’s departure left two new batsmen at the crease and, wary of opening the door for Afghanistan, Mohammad Hafeez and Haris Sohail batted with plenty of circumspection, Nabi leaking only 14 runs from his first seven overs.

Just as it appeared they had settled in, Hafeez carelessly guided the first ball of Mujeeb’s second spell to backward point while Sohail was adjudged lbw to Rashid Khan, leaving Pakistan on 142 for five with 15 overs left.

The momentum seemed to have turned, a feeling which increased when Pakistan captain Safaraz Ahmed, dropped on two, was run out out for 18, well short of his ground after coming back for a second that was not there.

Imad, though, had been given a reprieve early into his innings. He was rapped on the pad by Rashid and though technology showed that would have been overturned, Afghanistan had already spurned their review.

The increasing tension had the effect of largely subduing the crowd, though Imad raised the decibel levels with three fours in a Gulbadin over, also slicing to cover only for Asghar to lose sight of a swirling opportunity.

Another layer of intrigue was added when Shadab Khan was run out but Wahab Riaz launched Rashid over midwicket for a maximum as the equation was brought down to six from the last over before Imad closed the show with a cover driven four off Gulbadin.

Afghanistan’s total was heavily undermined by Afridi with figures of four for 47.

The teenage left-arm paceman leaked 10 runs in three balls in his first over before removing Afghanistan captain Gulbadin Naib and Hashmatullah Shahidi with successive deliveries.

Following Rahmat Shah’s dismissal for 35, Asghar Afghan arrived at the crease with a no-nonsense approach, depositing Imad Wasim into the stands beyond deep midwicket from just the third ball he faced.

Asghar, with the more sedentary Ikram Alikhil in tow, pushed the field back with some cavalier strokes but, after living by the sword, he took one risk too many and was bowled for 42 after missing a wild slog off Shadab.

After Ikram’s 66-ball 24 came to an end when he bizarrely holed out to long-on off Imad, Mohammad Nabi and Najibullah regrouped, though the former could not resist pulling the occasionally wayward Wahab Riaz to long leg.

Najibullah reverse swept twice for four but was largely composed in helping Afghanistan beyond 200 and therefore something to defend before dragging on to his stumps off Afridi, who took his tally to seven wickets in matches when Rashid spooned a slower ball to mid-off.