Pakistan landed in Sri Lanka last month with the aim of ending a nine-year series drought against the hosts in their home conditions. They were also looking to exploit the absence of Mahela Jayawardene and Kumar Sangakkara, who was available for only two Tests. They began well in Galle, fighting back from an early top-order collapse, but between the second Test in Colombo - which they lost - and the first three days of this Test, their batting was a major point of concern, and the players and team management struggled to explain the collapses.
It was that batting line-up, however, that fashioned a turnaround, chasing down a target of 377 with authority in three-and-a-half sessions over the fourth and fifth days.
Pakistan captain Misbah-ul-Haq, who had been part of three previous teams that had failed to win a series in Sri Lanka, described this 2-1 series win as "a dream come true".
"It was an amazing turnaround for us and this victory is a great achievement," Misbah said after the game. "I was with the Pakistan team in the last three series that we lost, but now winning the series here after long time is like a dream come true, specially after chasing a big total."
Orchestrated by Younis Khan's unbeaten 171 and Shan Masood's 125, this was their highest successful chase in Tests - the sixth highest overall - and also their best fourth-innings total. Their seven-wicket margin is also the biggest in Tests for a team scoring 350-plus runs to win a match. There were also some personal records - Younis ended the game with Pakistan's highest fourth-innings score in Tests and is only 19 runs short of surpassing Javed Miandad as Pakistan's highest run-getter in the format.
Misbah believed his side had done well in combating the Sri Lanka spinners in this game, and was pleased that their plans to negate Rangana Herath had worked. The left-arm spinner, who had tormented Pakistan last year, was dropped for the final Test after taking only two wickets in the first two games of the series. Misbah, however, was disappointed with the way the side had played offspinner Tharindu Kaushal on the first day of the second Test at the P Sara Oval, where the bowler took five wickets.
"We played the spinners very well but unfortunately we gave away five wickets to the offspinner and that was the turning point in Colombo," Misbah said. "Otherwise we played well in the first Test and negotiated well against Herath and the offspinner - that was key. It is always good to keep the opponent's best man out of the competition, it gives you a big, moral victory."
According to Misbah, knowledge of the track, which was expected to aid batsmen throughout, and a plan to stay calm and play as if it were the first innings of a fresh match had helped the team on the last two days.
"There were a lot of discussions before we came out for the fourth day. By knowing the conditions, nature of the pitch and the history we were quite sure that we could pull this off," he said. "This pitch doesn't offer much for the spinners and it could die for the seamers as the days go on, so it remained good for batting all the way through.
"The only way we could have lost from there was by panicking, but we managed to keep ourselves calm and played it like a first innings. We came here with a positive mindset to win this and we made up our mind that any target less than 400 is quite achievable. In the past we all have scored an ample amount of runs and we proved that we can do it again."
Despite the win, there are a few negatives for Pakistan to consider before their next Test series, against England in the UAE in October and November. Their inconsistent batting cost them many sessions. Ahmed Shehzad's form and the century by Masood, who was picked to replace Mohammad Hafeez, could set off another revolving door at the top of the order. The bonus, on the other hand, is the benefit of investing in players like Azhar Ali, Masood, Yasir Shah and Imran Khan.
"We can take a lot of positives from here, in the form of Yasir Shah, Shan Masood, Sarfraz Ahmed, as they have shown the ability to play under pressure," Misbah said. "The way Rahat Ali and Imran Khan bowled in spells gave us encouragement that the team is heading in the right direction. But there are things that we really need to work on, like the consistency in our batting.
"We have experienced some odd collapses which are unfortunate and spoil all the good work and cost us matches. We also need to work on the aspect of taking wickets with the new ball."
Misbah was also pleased that his team had played the Test series with much competitiveness. "If you see the three Test matches, they were all quite competitive and entertaining specially the third one," he said. "The way we came back was unexpected for everyone, and nobody believed that this match will end up like this but it did. This is what Test cricket is - it's a test of nerves, patience and technique. It is the real cricket that everybody enjoys and I am happy my boys carried it well to end it in an impressive way."
Misbah also praised Younis, who brushed aside indifferent form in the first two games to carve out a match-winning century. Younis had scores of 47, 6, 40 and 3 in the series before he became the only batsman to score five centuries in the fourth innings of a Test.
"(Having A player like Younis in the team is a blessing," Misbah said. "He is the sort of player who on a given day assures you an unlikely win, even if it's on the fifth day. His achievements are in front of us and explain what he is and what he can do. Credit should be given to the way Shan and Younis played. You could say they have played their best innings of their life, being under pressure. When you are chasing such a big target in a Test match, you can crumble under pressure and tend to make mistakes, but the way they both negotiated the pressure and every attack by Sri Lanka bowlers, it was amazing."