Rashid Khan became the first Afghanistan bowler to claim a five-wicket Test haul to put his side on course for victory after Ireland suffered a middle-order collapse in Dehradun.

Spinner Rashid finished with figures of 5-82 as Ireland were dismissed for 288, setting Afghanistan 147 to seal a first victory in the longest format in what is only the second Test for both countries.

Afghanistan were 29-1 at stumps on Sunday, needing another 118 to secure a historic triumph in the one-off encounter.

Ireland were reduced to 33-2 early on the third day when Paul Stirling was trapped leg before by Yamin Ahmadzai (3-52), but a stand of 104 between Andy Balbirnie and James McCollum gave them hope.

Balbirnie struck 11 boundaries as the Afghanistan spinners were unable to make further inroads despite generating plenty of turn, but the number three was eventually on his way after edging Waqar Salamkheil behind for an excellent 82.

That dismissal early in the afternoon session sparked a flurry of wickets, Rashid striking twice as McCollum (39), Stuart Poynter and Stuart Thompson departed in a flash.

Kevin O'Brien (56) and George Dockrell (25) offered resistance with a seventh-wicket partnership of 63, but Rashid snared them both lbw before James Cameron-Dow (32 not out) and last man Tim Murtagh - who followed up a half-century in the first innings by making 27 second time around - frustrated Afghanistan.

The duo added 58 before Ireland were eventually dismissed after 93 overs, leaving their bowlers a small window to strike before the close.

Mohammad Shahzad fell caught behind to Andy McBrine as runs proved hard to come by early in Afghanistan's chase, though they will be expected to get home on Monday.