Bill Chalmers who was crown agent, the permanent head of the procurator-fiscal service from 1974 to 1984, was a man of traditional values but was endowed with great vision to build a service to meet the challenges of the future and cope with an increase in serious crime at a time of economic stringency.

Chalmers was proud of his Aberdeen roots, having attended both Robert Gordon's College and Aberdeen University. He served as an officer with the Queen's Own Cameron Highlanders in the Second World War during which he was awarded the Military Cross.

He became a solicitor after hostilities ceased and practised in Aberdeen before joining the procurator-fiscal service as a depute-fiscal in Dunfermline in 1950. During that period he gained a reputation as a fiscal who was prepared to take on a difficult case and work on it to secure the best possible result. Although he had good relations with the police, he was always careful to ensure his and the fiscal's independence in the process of investigating and prosecuting crime.

In 1959 Chalmers was promoted to senior depute-fiscal at Edinburgh then, in 1963, entered crown office as an assistant to the crown agent before becoming deputy crown agent in 1967 and crown agent and Queen's and lord treasurer's remembrancer in 1974.

In the 1960s the fiscal service was a relatively small one, consisting of about 80 lawyers throughout Scotland compared to 350 today. Chalmers saw the need for a national prosecution service which not only dealt with sheriff court cases and prepared high court cases but took over the prosecution of cases in the burgh police courts in what became the district courts in 1975 and assumed responsibilities for prosecuting cases from government departments and local authorities.

Within a two-year period in the mid-1970s the number of lawyers employed in the fiscal service doubled to almost 200. With that change came the need to develop improved management structures and better accountability, while recognising the need for local discretion to meet the public interests of the area and the circumstances which can arise during the currency of individual prosecutions.

Chalmers was a tall, imposing figure who spoke with a terse, laconic drawl. More than once his voice was imitated by one staff member to another in a malicious telephone call to say that he had decided to post the receiver of the call to some far flung part of Scotland.

Eventually, once you got to know Bill he, too, had a sense of humour and there was often a twinkle in his eye, but mostly his presence and the opening from him of ''Well!'' was enough for him to get the full story and a few more confessions also.

His preparation for meetings was meticulous, yet he would often only have before him a small slip of paper on which he had written a few words by way of an aide memoir. These were the decisions he wished to secure from the meeting and such was his persuasiveness and authority that he usually did achieve them.

To meet the challenges of an increase in serious crime as well as taking over district courts, Chalmers commissioned research. This was a radical move in the 1970s and threw the service open to two young researchers, Dr Jackie Tombs and Sue Moody, whose Prosecution in the Public Interest (Scottish Academic Press 1982) highlighted the lack of alternatives to prosecution. In the foreward, Chalmers spoke of how ''the old methods are simply not good enough for modern circumstances. The approach of fiscals to their work has changed, is changing, and will change even more''.

Chalmers was a member of the two Stewart committees on alternatives to prosecution which led to fiscal fines and fixed penalties for less serious offences. He later developed a system of warnings to alleged offenders and encouraged schemes for certain offenders to be directed to social work and others to make prompt compensation for their crimes. The latter initiative was appreciated by victims who often became forgotten in the criminal process in those days.

Chalmers also looked abroad for ideas and supported an international project which looked at prosecutorial decision-making. It showed Scottish prosecutors to be consistent in their approach across a wide range of cases.

During Chalmers's tenure as crown agent, the fiscal service went from strength to strength despite in latter years having to cope with a government keen to reduce public spending. In due course, a senior official from the Treasury was dispatched to discuss the fiscal service with Chalmers with, it was understood, the usual 10% cuts in contemplation.

Chalmers met this challenge head-on with a full day of presentations on his plans and a large lunch with much to wash it down. When the hapless Treasury official returned to his desk in London the next day, no doubt nursing a hangover, he had waiting for him Chalmers's letter confirming the terms of the previous day's discussion and the increase in funding that had been agreed.

Chalmers's ability to secure resources was such that at his retirement dinner in 1984 Sir William ( Kerr) Fraser, the then head of the Scottish Office, remarked that ''Bill had not merely swum against the tide but walked on water.''

For all his interest in managing and developing an organisation, he retained a keen and personal interest in its casework. Chalmers was appointed a Companion of the Bath in 1984 for his work in the fiscal service.

In his retirement, Chalmers and his former opposite number, former director of public prosecutions Sir Anthony Hetherington, investigated war crimes allegations which later led to war crimes legislation and a number of investigations, notably in Scotland, one involving the late Anton Gecas. Even as a former soldier Chalmers found the inquiries he made in the Baltic states particularly harrowing. He also chaired a working party into speedy justice for children which produced a number of useful changes in an area of continuing interest. He also sat as a chairman of industrial tribunals and enjoyed dealing with the casework from his interest in personnel matters when head of a civil service department.

He was a keen and steady golfer and was a member at Luffness and Craigmillar Park. He played bridge up until his final illness.

Bill Chalmers had a long and happy marriage to Margaret of nearly 50 years and was a devoted family man. New lawyers arriving at the Crown Office were summoned at an early stage to a dinner party with their partner and on these occasions Bill, doubtless aided by Margaret, assessed what future talent he had in the service. When Margaret died in 1997 after a short illness, he was devastated and it was only then that colleagues realised the full extent of the support Margaret had given and the confidence she had inspired in her husband to achieve his visions.

Chalmers accepted his increasing immobility with great fortitude and kept up an interest in current affairs to the end. He was saddened by the changes which had taken place in recent times in the fiscal service which he perceived weakened its independence as an arm of the executive.

In his day, Chalmers said that he had always fought to keep the Crown Office separate from the Scottish Office and until devolution the Crown Office had been funded by the Treasury. When it was explained to him that matters had changed with the coming of the Scottish Parliament, he remarked ''Well I didn't vote for that either!''

While Bill Chalmers had traditional views on many matters, he was receptive to change and conscious of the need to provide a prosecution service fit for future challenges.

With all due respect to those who succeeded him, and to his eminent predecessor Stanley Bowen, he was known to many who had served him as The Real Crown Agent. A fitting memorial to Chalmers will be for the fiscal service to recover its pre-eminence in investigating crime and maintain its independence in a devolved Scotland.

He is survived by his son Roy, daughter Moira, and granddaughter Felicity.

William Gordon Chalmers, crown agent, born June 4 1922, died May 28, 2003