I'm sure he was wrongly convicted; whether or not he did it , is another matter; the conviction was unsafe.
The governmernt knew that the conviction would be quashed if he pursued an appeal, with embarrassment all round, not to mention what might emerge in the appeal. So his being ill was grasped as a good way out; he agrees not to make trouble like that and he can go home to Libya, the government can say how humane the Scottish justice system and government are, everyone wins. So long as he's not held up constantly as a hero of the people, nobody is embarrassed, and he wasn't greeted any more extravagantly than a sick man, who happens to be from a significant tribe, would be on being brought home. And he has died quietly, not as soon as expected; explained by the difficulty of predicting; of cancer.
Would be nice to know who did it, specifically and in the wider sense, how it was organised and on what authority, but we can guess the broad picture easily enough, and we can say with confidence that nobody in power really wants an inquiry to make the details public!