In Edinburgh's Old Town stands Ramsay Garden, where novelist and former royal press secretary Michael Shea lives, and works - under an astonishing collection of murals

Michael Shea sits with his back to one of the most magnificent views in Edinburgh. Under his windows, Great Northern Railway trains nose their way through Princes Street Gardens. Beyond lie the grey reaches of the New Town, punctuated by the occasional church spire and statue-top. The classical masses of the National Galleries and Royal Scottish Academy squat below on the Mound, while, farther right, is the tapered silhouette of the Scott Monument. Edinburgh in all its prosperous panoply is here, with the Firth of Forth and the hills of Fife in the distance. ''On a clear day,'' says Dr Shea with satisfaction, ''you can see as far as Ben Lomond and Ben More.''

The Queen's former press secretary prefers, however, to cold-shoulder this scene while working at his desk. Not without reason. The imposing salon in his recently acquired office flat in Ramsay Garden is elegantly furnished with grand piano and numerous photographs from his years in royal circles; a copy of his latest thriller, Spinoff, lies casually on a table. He lets drop discreetly that just after the Scottish parliamentary election, ''David Steel borrowed the premises for a little dinner with party leaders.''

But it is the salon's walls that command attention. They hold an extraordinary set of murals by the artist John Duncan (1866-1945), commissioned by that notable figure of town planning and urban improvement, Patrick Geddes (1854-1932). Shea's study was, earlier this century, the common room of Ramsay Lodge, a self-governing hall of residence for students - mostly medical - set up by Geddes.

Ramsay Garden, which incorporates the former lodge, is that handsome block of buildings whose off-white frontage, trimmed in red sandstone, stands out from the prevailing grey of Assembly Hall and Castle on the upper reaches of the Castle Hill. Its present physical presence is a product of the Arts and Crafts Movement, but incorporates the original octagonal house of Allan Ramsay, the eighteenth-century poet, and his painter son of the same name.

Patrick Geddes was not only interested in bringing a touch of collegiate life to this historic corner of the Scottish capital, he was also an art lover and theorist. Hence the commission to Duncan to decorate the walls of the student common room. In two periods, separated by 20 years, Duncan responded with an engagingly eclectic set of murals, mostly on his favourite Celtic themes but incorporating a diverse selection of historic Scottish notables from the Admirable Crichton and Napier, of logarithm fame, to Sir Walter Scott and Lord Lister.

Decades of co-existing with the lively young gentlemen of the medical school, followed by a period of commercial use, then redevelopment, have not been kind to Duncan's work. ''A century of Mrs Mopps has taken the top off some of the paint,'' says Shea mildly. Add to that the depredations of tobacco smoke, the occasional high jinks of the students (surely the white fangs on that little devil by the window are by an undergraduate hand?), and crude repair, and you understand why Shea laments the murals' ''pretty horrendous state'' when he took them over. On the bright side, perhaps even worse damage could have been caused by the young medicos who apparently enjoyed wielding giant catapults made of bicycle tires to rain ripe tomatoes down on passing tramcars on the Mound.

The warped frames of the murals have been replaced by oak and now it's a question of ''waiting for the wherewithal'' to do up the paintings themselves - a cost of some #100,000, their owner reckons. Meanwhile, even under their patina of dirt and varnish, they are impressive.

Their creator, John Duncan, is probably less well known than he deserves to be in the West of Scotland; his artistic career in Scotland (he spent 1900-03 teaching at the Chicago Institute of Fine Art) was largely confined to Dundee and Edinburgh. He is usually described as a Scottish symbolist, but his painting is greatly influenced by his life-long fascination with Celtic art.

Duncan, like many other Scottish artists, was not born into particularly creative circumstances. His father was a Dundee grocer; his mother a powerloom weaver. The young Duncan, however, had obviously a precocious talent, beginning studies at Dundee School of Art at the age of 11. By 13 he was probably doing illustrations for a local social-political comic, The Wizard of the North, as well as for the Dundee Advertiser. A stint as a ''hack work'' illustrator in London was followed by studies at the School of Art in Antwerp and then a pilgrimage to Paris, Rome, Florence, and Venice.

Back in Scotland he was drawn into the circle of Patrick Geddes, biologist, sociologist and social reformer, and art theorist. Duncan was much influenced by this charismatic figure. He took part in the summer meetings Geddes organised for teachers, artists, men of letters, musicians and post-graduate students in the Outlook Tower beside Ramsay Garden, and did illustrations for a short-lived magazine called The Evergreen that expounded Geddes's social views.

Geddes's commission to Duncan to do the Ramsay Lodge murals must have been most stimulating for the artist - all the more so, perhaps, since he had the assistance of three young woman artists who produced the Celtic tracery that originally surrounded his works. The Celtic themes of the first batch and scientific bias of the later murals were no doubt aimed at improving the minds and characters of the students.

Geddes justified their creation with uninhibited brio in his foreword to a booklet interpretating them: ''Below are told the stories of these pictures of the imagination, of magic and romance. Yet they were gravely chosen withal, and for reasons manifold: poetic, academic, even personal to the student's life of which they shadow forth the possible stages. But what if they be but dreams? 'We are such stuff as dreams are made of.' What if they be but magic and romance? These things are not ancient and dead, but modern and increasing. For wherever a man learns power over Nature, there is magic; wherever he carries out an ideal into Life there is Romance.''

The most eyecatching of the early murals shows the young King Arthur taking Excalibur (shown previous page). He doesn't yank it out of a stone in south-west England but from the waters of Duddingston Loch, where it is handed to him by his sister Morgan le Fay. The sword, according to the booklet, is a transmogrified red dragon whose wrestling with a white counterpart had prevented Arthur building a mighty fortress on the slopes of Arthur's Seat. This somewhat unorthodox text is transformed into a decorative tableau.

The young monarch, looking rather prissy with a kind of fur animal on his head, sits in the bows of a boat rowed by a white-bearded Merlin. ''In the background,'' says the official description, ''Nimue, the Lady of the Lake, is inwardly glad, as the wizard's oars are trammelled with the water-weed.'' Her private spitefulness notwithstanding, she looks perfectly demure, as do the three queens who always turn up at Arthur's time of trial. Painting beautiful, mythical women in flowing garb was one of Duncan's long-term preoccupations -and accomplishments.

The whole composition is frozen and static; even the eddies in the water have a two-dimensional solidity. The stylised water-lilies in the foreground are part of Duncan's typical floral repertoire. A smaller version of this mural shows a more vigorous Arthur with conical helmet and flowing hair.

Other figures from Celtic mythology flank the Arthurian mural. In one, the hero Cuchullin, weary of battling in the service of his uncle Conchobar of Ulster and suffering from gaping wounds, is lulled to sleep by his father Lugh, from the land of Faerie. He awakes in the mural with his wounds healed, stretching himself across the canvas while a handmaiden bears him his conical helmet. This painting could be seen as an allegory for the healing powers that the medical students would wield in their profession.

Another Celtic hero Fionn (Ossian's Fingal) engages in all-out combat with the sea-rover Swaran, a venerable Nord with walrus moustache. Stylised flowers and pine tree foliage plus a harper complete the energetic composition. Magnanimity is the theme, as the younger man, having bested his opponent, feasts with him and sets him free.

The Journey of St Mungo should be of particular interest to Glaswegians. Mungo himself is a rather epicene figure, though he shows his muscle by leading a pair of untamed bulls by the head. From the wain they are pulling peers a monkish figure. This is evidently the aged saint, Fergus, who has died for joy in Mungo's arms, though he still appears disconcertingly alive. Mungo himself, embodying ''the holiness of the past and the strength of the present'', could be seen as another exemplar for the young. The Vision of Johannes Scotus Erigena shows the controversial

ninth-century philosopher and theologian contemplating a self-damned, naked soul. The interpretative booklet quotes the curious lines: And the sin I impute to each frustrate ghost,/Is the unlit lamp and the ungirt loin. Was the moral here against sloth and carnality?

More mental improvement with Aristotle guiding the hand of the twelfth-century Michael Scot as he translates Aristotle's works from Arabic into Latin. And then there is the Admirable Crichton, born in 1560. This versatile young man graduated from St Andrews at the age of 15 and proceeded to carve a reputation on the Continent. ''Book in one hand, sword in the other, the soldier's garb beneath the scholar's gown, as the picture shows, he may well figure as a typical combination of Thought and Action. In learned disputation and in hand-to-hand combat alike, he stands - the gentleman unafraid,'' says the explanatory text. He also is something of a dandy with floral garters and pompomed shoes. Killed basely at the age of 30 by an Italian prince, Crichton could be the criterion for a gentleman student.

When Duncan added several more murals to the common room in the 1920s his themes were somewhat more contemporary but still inspirational. He himself contributed the explanatory text for these. John Napier of logarithm fame is shown on the parapet of his castle at Merchiston ''face to face with the immensities'' - a ''White Procession'' drawn within the ''reach of apprehension and measurement by means of his magical art of logarithm''. A benign, shirt-sleeved James Watt tends the parts of a steam engine while Prometheus brings fire for the service of man. Duncan quotes Sir Walter Scott's description of Watt as ''a most profound man of science'', the ''abridger of time and space'' and ''a potent commander of the elements''. This mural has almost the feeling of a Stahkanovite poster.

Not so the one showing Sir Walter Scott himself silhouetted by candlelight and watching a vision of the great Montrose sweeping past Inveraray to ''smoke out Argyll''. Duncan is lyrical about Scott: ''Like Michael Scot, Sir Walter was a wizard too; he could call spirits from the vasty deep, and when he called they came. His writings are the chronicles, legends, and life of his country, and in them breathes for ever the unconquered spirit and idealism of his race.''

The next mural is a puzzler. Darwin with bald pate and Methuselah beard is shown listening to pipes wielded by the incongruous figure of Pan. Duncan's notes are of little help. ''The Greeks,'' he writes, ''had arrived at the idea of 'cosmic and animate progress' - a 'progressive becoming'. Their science had at last been brought together into the conception of a unified whole, and this they symbolised in their figure of the god Pan, a composite being half brute half man . . . In our picture Darwin is shown taking up the problem anew listening to the pipings of Pan.'' Mmm. . .

The final mural is a tribute to Lord Lister, whose introduction of antisepsis revolutionised medicine throughout the world. The great man, a sombre figure with Victorian sideburns and bow tie, is shown at the bedside of a whey-faced boy, while the spectre of death hovers impotently in the background. ''It may be questioned whether any single individual has ever rendered a greater service to humanity than Lord Lister,'' concludes the artist's notes. What better ultimate role model for the medical students of Ramsay Lodge?

Michael Shea has a more personal connection with John Duncan than mere ownership of his murals. ''Duncan was a great friend of my father's. I'm his godson,'' he explains. A charming framed sketch of the infant Shea by Duncan underscores the family link. Duncan, himself a loving parent of two daughters though his marriage failed, sent lots of letters to Michael Shea's father in which he inquired after his godson. ''He asked if my appreciation of art was fully developed at the age of one-and-a-half!'' laughs Shea. And he would write: ''I want to know what he says. I want to hear some wisecracks. Do you teach him anything? Does he teach you?''

Shea has other works by Duncan - including a picture of the dying St Columba saying goodbye to a white horse and a Cadell-like view of Iona - in his other flat in Ramsay Garden. Meanwhile, back in the former lodge, he mentions that Madame Curie and Louis Pasteur in all likelihood once lectured in the common room. They and their audience are long gone but there's a thread of continuity in the fact that Shea's Spinoff has a medical theme. Did he ponder the ingenious plot - involving a mysterious plague from Africa being spread by malice and countered by intrepid medical researchers - at his window desk, under the watchful eye of Lord Lister?

Spinoff is published by HarperCollins at #16.99.