Mahmood was replaced by Jon Lewis for the third Test against Sri Lanka. However, on 27 July 2006 he was selected ahead of Lewis for the second Test against Pakistan at Old Trafford after Liam Plunkett was ruled out due to injury. Although the pitch at Old Trafford favoured seamers, Mahmood performed relatively poorly. However, he was retained for the Third Test at Headingley. He contributed 34 runs with the bat in England's first innings, but then went for 108 runs over 24 overs, albeit with two wickets, in a high-scoring Pakistan first innings. In the second innings, he took 4 wickets for only 22 runs in 8 overs, contributing significantly to England's series-clinching victory. He featured in the final match of the series, dubbed Ovalgate. He took 2–101 in Pakistan's first innings before the game was forfeited by Pakistan for refusing to take the field during England's second innings.