Yesterday afternoon I watched Mahela Jayawardene and Kumar Sangakkara at the nets. I have seen them bat together on a cricket field a million times, but watching two batsmen in the nets is different. They are next to each other, facing the ball at the same time, one right-handed, one left-handed, their bats facing one another, Sangakkara's lifted higher, Jayawardene's coming down straighter, but each making sweet music as it meets the ball.

I waited for the moment, and it came, two cover drives, played almost simultaneously, Jayawardene's a caress, Sangakkara's a thrust, and I imagined the balls meeting each other to exchange notes. They wouldn't have, because Sangakkara's went squarer and Jayawardene's straighter, but for a brief moment their eyes met, or so I imagined, almost appreciative of each other, and then they resumed the business of focusing on the task at hand as the next bowler ran in.

And then the horrible thought struck me: Mahela and Sanga, friends and comrades, the nicest men you would ever know, among the most prolific run-getters of our times, leaders of men and torchbearers of a wounded nation, and this is the last time they might be batting together in the nets, preparing for what could be their final battle together. Were they as aware of it as we were? Was it going to weigh them down or stir them to something magical? Surely, we were not about to see the last of Mahela. We are not ready. Not just yet.

But cricket writes its own script. It denied Don Bradman the perfect finish, and the perfect average, but in doing so it created the most poignant ending in the game. Sri Lanka, the finalists of the last two World Cups entered this quarter-final not as favourites, but they were against a team up against the scars of their own history. The toss was won, and it was down to the batsmen, Sanga and Mahela, the most prolific and the most dependable in their history, to deliver a score that would melt the most nervous of chasers at World Cups.

Sangakkara came to this match having made four silky hundreds, a World Cup record. Mahela had the pedigree of big-match temperament, if not the greatest form. His only hundred in the tournament had been against Afghanistan but it came when his team had been four down for 51 chasing 232. Two of his other World Cup hundreds had been the semi-final-winning effort in 2007 and a poetic and elegiac one in the 2011 final, both at more than run-a-ball and both when the start had been less than ideal. Apart from South Africa's battle against their own demons, that was the advantage Sri Lanka carried in to this match: experience of men who knew how to own the big stage. At three wickets down, Sri Lanka waited for deliverance.

Jayawardene's walk to the middle was brisk. A couple of springy hops outside the ropes and he was on his way, head down, past the departing batsman, to be met by his trusted accomplice, who had walked past the 30-yard circle to escort him to the battlefield. Jayawardene and Sangakkarra bumped fists but not a word was spoken. They had spent the previous evening together, dining with their wives, as they had done on many occasions before, not talking cricket but perhaps drawing comfort and security from the familiarity. It was down to them now to make sure this wasn't their last time together in Sri Lankan colours.

But something wasn't right. Sangakkara's majesty had deserted him. The South African new-ball bowling was sharp and aggressive and the fielding predatory, but Sangakkara's strokes were finding the fielders with worrying precision. It was down to Lahiru Thirimanne to get the Sri Lanka innings going but it was his dismissal to a miscued drive that brought together the familiar partners. By now, 300 was perhaps out of reach but, with the ball stopping and a hint of turn, perhaps even 250 would keep Sri Lanka's nose ahead.

The first runs with Jayawardene at the crease come via leg byes, an attempted tickle failing to find the bat, and 11 balls later he survives a leg-before appeal which, upon review is found to be marginal. But the worry is that Jayawardene has failed to pick Imran Tahir's googly. It is not the script written by Sri Lanka. Not a trial by spin for sure?

But there is spin from two ends already. There is nearly a run-out in the next over, from JP Duminy, as Sangakkara charges down the wicket while Jayawardene is ball watching. Four balls later, Jayawardene shapes to pull Tahir but ends up giving a limp catch to midwicket.

Batting can feel cruel. In no other sport can a single mistake be so utterly devastating. On another day, Jayawardene would have put that ball away for four. But today, it brought a magnificent career to an end. Who would have thought Sri Lanka would lose seven wickets to spin against South Africa? Who would have foreseen a hat-trick for Duminy?

There was sadness too in that Jayawardene was denied a shot at opening in this World Cup, a position he thought -- as did many others -- would have suited him, and the team, more in the final phase of his career. The selectors were convinced that they needed him to marshall the backend of the innings. But when Sri Lanka, as they had done in their final match in the 2011 World Cup, made a couple of surprising changes, they opened with Kushal Perera, who had played only one match in this World Cup, and handed an ODI debut to a rookie spinner. Jayawerdene was left to bat at the No.5.

A few minutes after his innings ended, I met Rahul Dravid in one of the commentary boxes. The game owes a fairytale ending to no one, he said, and no one should expect one. But no one, he added, would judge or remember Mahela Jayawardene by his final innings. There were tears in the Sri Lanka dressing room after the match ended. Not all the moist eyes around the cricket world would have been Sri Lankan. No one is bigger than the game, but cricket might miss him more than he misses cricket.

Sambit Bal is editor-in-chief of ESPNcricinfo. @sambitbal