The last time Sri Lanka won an away Test against a side ranked higher than them was in June 2014, so long ago not just in years but in what has passed in between, that it really was - as the past is said to be - another country.

This last year in particular has been rotten in so many ways, so it was no surprise that a beaming Dinesh Chandimal, still green as a captain, pronounced himself "over the moon" after a magical, against-the-odds win in Abu Dhabi.

Chandimal's epic, first-innings 155 played a major part in the 21-run win over Pakistan, as did his marshaling of his attack and team on a tense final afternoon. In the process Sri Lanka became the first visiting side to win a Test at Zayed stadium. After a thorough drubbing at home by India, there couldn't have been a sweeter - and more important - result.

"The guys gave hard work before the match started, and finally that hard work paid off," Chandimal said. "As a team, we were below par in our performances [against India], but we have waited for this win and finally we got it. Credit goes to all the players.

"They played some really good cricket and I'm sure this can continue throughout the series. We did more work on our fitness and fielding, and discipline. Everyone put their heart and soul into the practices, and the management put lots of hard work in."

A Sri Lanka win was a distant prospect when the final day began - tottering, effectively, on 66 for 4. They had seemed dazed on the fourth afternoon and nothing from their work over the previous months suggested they could recover.

But they knew, with Rangana Herath in their attack and Pakistan against him, they needed desperately to put together any score upwards of three-figures to give themselves a chance.

"It was a tough time, especially last evening," Chandimal said. "We were surprised to be four down for 40, or 35. We were surprised, but we thought before play started today that 160-plus would be a winning total.

"[Niroshan] Dickwella was outstanding in the second innings to get us to the 140 mark. We all knew the legend Rangana would come into play, and finally he did his best."

That the legend - or "wily old fox" as Chandimal also called him - did. A six-wicket haul, and 11 for the match, included all manner of landmarks - the last was his 400th Test wicket and the penultimate, his 100th against Pakistan.

Asked how long he would like Herath to play in his side, given he is nearing 40, Chandimal made a little wish. "I just want him throughout my career.

"I have no idea how long he is going to play, but I am sure he will do what he can for the team. Rangana is a team man. He is supportive to me and the players, with what he has learnt from cricket. Every young player goes to talk to him about his bowling and experiences."

Osman Samiuddin is a senior editor at ESPNcricinfo