In the course of a friendship that lasted a quarter of a century, I got to know several Clive Fairweathers.

There was the gallant SAS soldier who helped plan the Iranian embassy operation in 1980; the man of principle who espoused the cause of Scottish prisoners and fought on their behalf for better conditions; the compassionate veteran who did his utmost to help former service personnel suffering from the mental ravages of the battlefield; and the unfulfilled concert pianist who still did a fair turn tickling the ivories.

Oh, and there was the bright-eyed joker who invented a special code for our many meetings – mainly to discuss the work of Combat Stress, the ex-services mental health charity for which he worked as chief fundraiser in Scotland while I served as a trustee. The message went something like this: date and time, name of drinking establishment and the cryptic words "red infuriator". Ahead lay an early evening of serious conversation, leavened by gossip, all over a decent bottle of claret.

All of these elements made up the same soldierly character and in Clive's case the sum was always the equal of all the separate parts. I may not have known him as well as many of his myriad army chums, but we had lots in common – an interest in all things military, the well-being of the British Army and the failure of different governments to do their best for the armed forces; and, of course, our shared involvement in the work of Combat Stress.

We first met in the early 1980s at a Ministry of Defence "lessons learned" briefing to discuss the Iranian embassy siege. At the time there was still a lot of residual anger within the army about the role of the media, especially the transmission of live footage of the SAS beginning their operation against the terrorists. The argument was that the BBC and ITN had put the operation in jeopardy by broadcasting material that could have helped those inside the building.

One youthful-looking SAS colonel – who had been second in command of the operation – disagreed. Clive (for it was he) instead argued the army had missed a trick by not taking the media into its confidence and working with them – in return for silence at that time, journalists would then have been given access to the real story. In the days before freedom of information and at a time when there was deep mutual suspicion between journalists and soldiers, this was pretty radical thinking.

We met up again later in the decade when he had left the SAS and returned to regimental soldiering with the King's Own Scottish Borderers. At the time he was acting as the commanding officer of the Scottish Division's training depot at Glencorse, outside Edinburgh, where young soldiers bound for Scotland's infantry regiments were put through their basic training. One visit was enough to see how much those raw recruits respected and admired him, not just because he was an awesome figure in army circles but also because he brought a sense of compassion and fairness to ease them through the rites of passage towards soldiering.

A sense of fun was never far away and it was always mixed with good sense. I had been asked to write a TV film about the training of Scottish infantry soldiers and there were some basic requests that I passed on to Clive. We needed to follow the fortunes of two recruits likely to complete the course, and they had to be self-assured and articulate. The two chosen were real stars. After the passing-out parade I thanked Clive, who said he had added one other qualification: "I made sure they didn't have any facial plooks!"

Within a few years Clive had left the army and had become chief inspector of prisons in Scotland, a job he carried out with enthusiasm and good sense, though it brought him into conflict with the Government. It always seemed mad to me that the politicians asked him to go into Scotland's prisons to reveal the truth of what was happening then complained when he did just that.

When he was felled by an incurable brain tumour in June, all of his many friends were stunned. One of his former army mates put it best when he said with sad simplicity: "Big man down." As for me, I'm going to miss immeasurably the man – and those cryptic codes.

Trevor Royle is a military historian and chairman of the charity Combat Stress in Scotland

A LIFE DEDICATED TO SERVICE

Scotland's former chief prisons inspector, Clive Fairweather, has died at the age of 68 after succumbing to a brain tumour.

Born in Edinburgh, he had a distinguished 34-year long military career and completed three tours with the Special Air Service.

He was the security adviser to the Iranian and Jordanian Royal Households in 1970-71 and was also in command of one of the SAS teams that recaptured the besieged Iranian Embassy in London in 1980.

He later took the role of Her Majesty's Chief Inspector of Prisons for Scotland from 1994 until 2002, and was made a CBE in 2003 for public service.

He was passionate about prison reform and was also the chief fundraiser for the ex-service charity Combat Stress.

First Minister Alex Salmond said he was "saddened" to hear of Fairweather's death and offered his sympathies to his friends and family.

He said: "As chief inspector of prisons he brought to the job a unique combination of humanity and common sense which demonstrated how an enlightened prison regime would operate in the public interest. I will very much miss his contribution to Scottish public life."

Willie Rennie MSP, leader of the Scottish Liberal Democrats, said: "Clive Fairweather was a compassionate, brave and intelligent military leader who gifted that considerable talent for wider public benefit."

Scottish Conservative leader Ruth Davidson said he was a "true gentleman, good company and compassionate, and simply liked to get things done".

Fairweather died at the Western Infirmary in Edinburgh on Friday. He leaves behind one son and one daughter.