Ireland put up a great fight in their second innings as Kevin O'Brien scored his maiden Test century and Steve Thompson a half century but it was not to be as Pakistan chased down 160 on the final day losing only five wickets.
Ireland's hopes of pulling off a sensational victory in their maiden Test were enhanced on day five in Malahide as Pakistan dramatically collapsed to 14-3 having been set 160 to win.
The Wicklow wonder and man of the match, Ireland's first Test centurion Kevin O'Brien was a little disapointed naturally: "A slightly better morning session for us and we could have pushed Pakistan harder, it was disappointing not to get those extra 40/50 runs".
He was ably supported by Babar Azam (59) as the duo stitched a crucial 126-run stand after Pakistan had been reduced to 14/3.
Kevin O'Brien, who on Monday became the first Ireland batsman to score a Test hundred, fell to his first ball on Tuesday as Mohammad Abbas had him caught at slip for 118.
But after the break, Thompson upped the tempo and while O'Brien was content to nudge the singles, Thompson took 11 off an over from left-armer Rahat Ali and followed up with two more off Amir. Soon, the home fans at Malahide were celebrating as Ireland's pacers tore through Pakistan's top-order.
However, debutant Imam and Babar maintained their composure to combine for 38 runs before lunch and their alliance continued well into the afternoon after the latter was dropped by Andrew Balbirnie off Murtagh on nine.
The now 26-year-old Amir's cricket career nearly came to an end following his involvement in a spot-fixing scandal during a 2010 Test against England at Lord's. A man who knows a thing or two about Test match history, veteran Pakistan journalist Qamar Ahmed - watching his 435th Test match in the last 44 years - described the match as "one of the most fantastic and absorbing" he has witnessed considering Ireland's fightback.
However, O'Brien's incredible performance helped his side gain a foothold in the match, building a lead of 139 ahead of today's final innings.
Their previous Test, against Sri Lanka in the UAE in October, saw them beaten after a target of 136 proved beyond them as left-arm spinner Rangana Herath took six wickets for 43 runs. Unfortunately, he came back after five years [out] and since he came back he has played every format for us.
"I think it's very good for Pakistan as a team to chase this on the fifth day".
Murtagh gave Ireland a flying start with the ball on the final day.
This was a game to display the true folly of the ICC's exclusionary policy in Test cricket with Ireland showing that the game's oldest form could only benefit from fresh blood, that the sport is only dying out while its governing body allows it to. "And we were in that first innings, but to get to 340 shows the character in that changing room and the passion we have to play for our country".