Let's assume that the conviction of Abdul Baset al-Megrahi for the murder of those on Pan Am Flight 103 is correct. If it is not, then obviously there should either be a retrial or a judicial release, with the debate on whether to free him on health grounds being irrelevant.

For now, though, he stands guilty of the murder of 270 people in December 1988 and has served only a third of the 27-year sentence that was handed down.

There is both a certain nobility and an utter stupidity in the calls for his release because he is suffering from prostate cancer. It demonstrates a remarkable willingness to show compassion to someone who did not act compassionately and that is a quality that has to be admired.

However, the assumption that it is better to prefer mercy to cruelty rests on a false dichotomy which simply does not apply to al-Megrahi, or indeed anyone who has been tried by due process of the law. The debate is not between kindness and vengeance but between justice and a skewed sentimentality that views the perpetrators of a wrong as a victim of the system and transfers onto them the sympathy that actually belongs to those who suffered from the crime in the first place.

This goes to the heart of the four different purposes of prison: first, to punish the person who committed the unlawful act; second, to educate the person and hopefully rehabilitate them back into society; third, to protect society from any further harm that the person might do if free; fourth, to deter others who might seek to emulate the deed.

If criminals happen to die in prison, then that may mean they do not have the chance of living and dying in freedom once their sentence had been completed – but then that is a risk they brought entirely upon themselves through their own actions. It is called "consequences", not "vengeance".

In the specific case of al-Megrahi, early release would be a spectacular denial of all four purposes of his sentence. Short of all victims suddenly coming back to life, it is hard to understand why his punishment should be lessened (some might argue it should have been longer). Impending death would also mean there is no new useful career that he should rush to fulfil.

Even worse would be the impact on society: going back to die in Libya may mean he is no pysical threat to others, but the hero's welcome that he might receive would be desperately hurtful to the relatives and friends of those who died. The deterrent effect would also be seriously injured if he was greeted with garlands and lionised.

The same ghastly error was made with Ronald Biggs: his smiling demeanour after his release was an appalling affront not just to those affected by the original robbery but to anyone who felt he had mocked justice for years, and helped blur perceptions of right and wrong through his guise as a nice chap really who only wanted a pint at his local pub. So did the train driver.

The key issue is not to let woolly thinking distort the meaning of compassion. Compassion means giving dignity to those in prison – whether through their personal treatment, the activities made available to them or the medical care provided when ill or dying. It means making their sentence bearable, not commuting it.