Robin Halward, who has died aged 55 from lung cancer, was an outstanding prison governor who went on to become an impressive director general of the Northern Ireland Prison Service from 1998 to 2002, in a post which was not for the faint-hearted. His appointment that September came five months after the Good Friday agreement at a time when the focus of the work was changing. There was staged release of paramilitary prisoners, the estate was contracting, and staff numbers reducing.

Robin managed this mix with his customary skill, securing loyalty and affection across the service. Northern Ireland Office ministers trusted him. So did rank and file officers. They loved him as a straight-dealing leader who managed them without pretence or ostentation. They knew he knew his stuff.

The son of a civil servant, Robin was born in Watford, Hertfordshire. The family eventually settled in Godalming, Surrey. He was educated at the Royal grammar school, Guildford, and Trinity College, Cambridge. He read history for two years and then switched to law.

Robin's interest in criminology and criminal justice was fired as an undergraduate and he joined the prison service in 1973 as a junior governor accumulating experience working with young offenders at the then Gaynes Hall Borstal in Cambridgeshire, with long-term adults at Gartree in Leicestershire and in central training.

His competence and a flair for motivation meant that promotion came quickly. In 1984 he was appointed deputy governor of Strangeways prison, Manchester, and, during the next 14 years, held a succession of high-profile posts. At Strangeways, he was central to the implementation of fundamental reforms to prison officers' pay and working arrangements enshrined in the Fresh Start package. He then took on a senior role developing regimes in the 30 or so institutions in the north region.

At 39, Robin became governor of Leeds prison, an old overcrowded city jail with fragile industrial relations and a sad record of suicide and self-harm among prisoners. In two years, he stabilised the prison and set a course for improvement.

In 1992 he was selected to head the team preparing the bid to run the refurbished Strangeways, badly damaged by rioting prisoners in 1990. This was the first time the management of a prison had been put out to tender and the team beat competition from a number of private-sector contractors largely because of Robin's appreciation of what was needed, the application of his experience and the trust he inspired. He governed the prison until September 1995.

Damaging escapes of high-risk prisoners from Whitemoor and Parkhurst renewed interest in the construction of a "supermax" prison, proposed in the 1966 Mountbatten report. In 1996, Prison Service officials headed by Robin produced a report on the idea, which was a model of clarity, thoroughness and thoughtfulness, but it was put aside in the latter days of John Major's government.

After a spell as an area manager for the prison service in Mersey and Manchester, he became secretary to the Metropolitan police committee (forerunner of the Metropolitan police authority). Then came Northern Ireland.

Back on the mainland, Robin became deputy director general in the Home Office's beleaguered immigration and nationality department, though this was cut short when cancer was diagnosed in October 2003. He remained active in voluntary work; he was a member of the Bury primary care trust; he also worked with the Butler trust which exists to recognise excellent work done by prison and probation staff to improve care of offenders, and with a group supporting the partners of prisoners.

Until a few months ago, he and and his wife Valerie were able to enjoy walking in Cumbria and holidays on the Canary islands. Robin's courage and dignity during his final illness never wavered. Such was his modesty that it is unlikely that Robin realised quite how many people he touched in so many different ways.

He is survived by Valerie and their two children, Elizabeth and Richard, and his mother Joan and sister Bridget.