The Scottish Government tried to secure more powers for Holyrood as part of a controversial prisoner transfer agreement between the UK and Libya, former Scottish justice secretary Kenny MacAskill has said.

Mr MacAskill, who sparked an international outcry when he released the Libyan convicted of the Lockerbie bombing on compassionate grounds, said while SNP ministers had been "powerless" to stop the deal being signed in 2007, they had tried to win concessions from the then Labour government at Westminster.

The Scottish Government unsuccessfully pushed for powers over air weapons to be devolved to Holyrood, Mr MacAskill said, as well as for compensation for "slopping out" in prisons, with legal actions from convicts over the practice costing ministers in Edinburgh millions of pounds.

Read more: Revealed - MacAskill may have breached Official Secrets Act over Lockerbie

But he said no compensation was paid and responsibility for regulating air weapons was only transferred to Holyrood as part of the 2012 Scotland Act, prompting Mr MacAskill to say the Scottish Government "got nothing" out of the deal between the UK and Libya.

Mr MacAskill, who has written a book about the Lockerbie bombing, also accused the UK and US administrations of "unbridled hypocrisy" for criticising his decisions on Lockerbie bomber Abdelbaset al-Megrahi at the same time as they dealt with the Libyan leader Colonel Gaddafi.

The former justice secretary, who stood down from Holyrood in May, said the Lockerbie bombing was "state-sponsored terrorism by several states, by Libya in particular", with Gaddafi "the main man" in this while Megrahi was a "simple foot soldier in the service of the Libyan state".

HeraldScotland:

He told BBC Radio Scotland: "I met Megrahi briefly, he was a foot soldier. (US) President Obama a few weeks before I released Megrahi met and shook hands with Colonel Gaddafi. Tony Blair and Gordon Brown embraced Colonel Gaddafi.

"If you are going to look at culpability let's look at those who dealt with the main man as opposed to those who dealt with a simple foot soldier in the service of the Libyan state."

While he said he accepted why some families had wanted Megrahi, who was diagnosed with terminal cancer while in prison in Scotland, to die in jail, he said someone "irrespective of what they've done has a right to die with some dignity".

Read more: Campaigners - MacAskill has called into question Megrahi's conviction

Defending the release of Megrahi in 2009, Mr MacAskill told the Good Morning Scotland programme: "Their family has committed no offence and they should in the last moments be able to interact with them. That should apply whether you've been a heinous murderer or a saint."

He wrote the book The Lockerbie Bombing: The Search For Justice because there is a "huge desire not just in Scotland but around the world for some answers to what happened and why with regard to Lockerbie".

While Mr MacAskill said he has "no doubt I made many mistakes", he added: "I believe all those in Scotland, whether police, prosecution or the courts, acted diligently and with integrity. But what happened was a world out there, especially countries such as the USA and the UK, acted shamefully.

HeraldScotland:

"It suited them to pillory myself in Scotland at the same time as they were conniving with Colonel Gaddafi, when they had been involved in shoring him up before they tore him down with spectacular consequences."

He accused the former Labour government at Westminster of agreeing the prisoner transfer deal with Libya "for the benefits of BP", which went on to sign an oil exploration agreement with the Libyan government.

Mr MacAskill claimed: "At the time when the British were driving through a prisoner transfer agreement with Libya, predicated on getting Megrahi back because they were doing a deal with British Petroleum, we made requests for some compensation and for powers that were held by Westminster at that time.

Read more: Kenny MacAskill claims Jack Straw admitted commercial interests were at heart of Megrahi talks

"They were refused by the British government, they didn't give them to us. We had no powers to stop it but ultimately I declined to grant the prisoner application."

He continued: "We were powerless in all this because we couldn't stop the prisoner transfer agreement being signed because that was between the United Kingdom and Libya. Equally when the prisoner transfer agreement had been signed it was within my power to refuse it, which I did.

"We asked if the British government would compensate us for slopping out in Scottish prisons and indeed would take action to give us powers over air weapons.

"It was refused, the powers have now subsequently been devolved but we were never compensated as such, so the Scottish Government got nothing out of this."

Megrahi died in Libya in 2012, three years after he was released from a Scottish jail on compassionate grounds. He remains the only person ever convicted for the 1988 atrocity in which 270 people died when a Pan Am flight on its way from London to New York exploded above Lockerbie, killing everyone on board and 11 people on the ground.

In October 2015, Scottish prosecutors revealed they want two Libyans they have identified as suspects in the case to be interviewed by police.