India has long occupied a special place in the imagination of outsiders. It is in every sense an astonishing country - rich in history, inhabited by the most remarkable and engaging people, with virtually every type of landscape, from Rajasthan deserts to Himalayan snowfields. For those smitten by India there is a rich body of literature in English to nurture this passion: memoirs, topography, history, religion, philosophy, and, of course, fiction. And in pride of place in fiction, the novels of RK Narayan, all well-loved short books and each of them a delightful window into India.

Narayan is one of those novelists who commands universal affection. He led a relatively simple, family-oriented life, and he died more or less where he began, a member of the same community which he so lovingly recorded in his novels. And when he died, a whole world came to an end - the world of Malgudi, the town he created and peopled with a cast of characters who remain utterly memorable.

Narayan was born in Madras, and his life more or less spanned the century. The India into which he was born was that of the British Raj. To be born an Indian at such a time involved being part of a somewhat complex and contradictory society. While being a citizen of a worldwide empire, one was also a member of a nation that had been conquered. That gave rise to a particular form of cultural identity in which one was part of a metropolitan culture yet peripheral to it, a semi-outsider. But then there was one's own culture - in Narayan's case, Hindu - which gave a very strong and complete identity, much stronger in many respects than the imposed culture of colonialism. This mixture of Hindu and British cultural influences meant that an educated citizen of the Raj had at least two great and subtle languages upon which to draw; two world views; two aesthetics; two souls, perhaps.

Rasipuram Krishnaswami Narayanaswami (simplified to RK Narayan, at the suggestion of Graham Greene) was a member of a comfortable Brahmin family in Madras. His early life is well documented in his entertaining autobiographical memoir, My Days, published when he was almost 70. In India, family background and caste could then, and still may, determine what one was to do with one's life. Narayan's caste was one noted for its intellectual distinction and high culture.

His father was a headmaster, whose work required that he be transferred from time to time, and for this reason, among others, Narayan's upbringing was largely entrusted to his grandmother. She instructed him in arithmetic, mythology, classical Indian song and Sanskrit literature. If one looks for the early influences that set Narayan on the course of being a writer, then surely it must be these afternoons at the feet of his grandmother.

He believed in his vocation and he felt sufficiently confident, after an indifferent education, to set himself up as an author. There had been a few half-hearted attempts at a more conventional career, including a spell as a teacher, but these never amounted to very much. Fortunately for Narayan, the Hindu family system was sufficiently supportive for him to set out to live the life of a man of letters.

Narayan's early novels are very clearly autobiographical in inspiration, and one of them, The English Teacher, deals with a tragedy which he himself experienced - the loss of a young wife. Narayan's marriage had been a love-match, though one which had taken place in the context of all the complicated family negotiations that accompany Hindu marriage. His wife's death from typhoid was movingly described in the pages of The English Teacher and again in My Days. He was devastated, but he came to an acceptance of what had happened, and, as his friend Greene had predicted, after a time he began to write again. The novels now moved into a new and more mature phase in which the personal experience and concerns were replaced by proper fictional discipline and objectivity.

This second group of novels: Mr Sampath - The Printer of Malgudi, The Financial Expert, and Waiting for the Mahatma, show Narayan maturing as a novelist, and starting to fill in the canvas on which he was to paint his masterpiece, the picture of Malgudi. The three books were published between 1948 and 1952, a period of great importance in 20th-century history, which not only saw the emergence of independent India but also the birth of a completely new world order.

A strong sense of being caught up in change pervades all of them, even if history is observed from a very particular perspective - that of a perfectly imagined town peopled by a cast of colourful and eccentric characters. Narayan was not a great exponent of plot. His novels often have a rather rambling feel, and there is little sense of urgency in identifying a unifying theme. But therein lies their charm.

Narayan generally writes about people whose lives do not always follow a clear direction. They may be striving for some goal, but they are not always sure what this goal is. As a result the novels sometimes have false starts and shifts of direction. There may also be a lack of resolution. Such characteristics may strike some as faults - and indeed many critics have taken that view - but they give to Narayan's stories a delightful, organic feel. Because we know that our own lives may often be a bit directionless and vague, Narayan's characters seem very real and true to life.

Waiting for the Mahatma is the most overtly political of the Malgudi novels. It is an important part of the Narayan oeuvre because it dwells upon a theme found throughout his work - that of a society in transition and the effect this has on individuals. It also shows us that Narayan was not really a politically engaged novelist, for which he has sometimes been criticised: how can one write about a society in which great issues of poverty and injustice are present and not address these issues more directly? How can one dwell on small dramas in the lives of middle-class people when the lot of so many is a grinding struggle to survive?

Sriram, the central character in Waiting for the Mahatma, is a typical Narayan character - comfortably off without being rich. His world is bounded by the borders of Malgudi; beyond that is the world of village India which he barely recognises when he encounters it with the politically conscious girl who takes him under her wing. The world of the untouchables, forced to scavenge on the edge of the town, is also present in this novel, but it is peripheral. The people from that world, and the villagers too, are not ignored, but the book is not about them.

This is not to say that Narayan is unsympathetic. It is just that the book's main thrust is personal rather than political. The great causes - Indian freedom, social justice - are present, but they are handled in a different way from that of a more determinedly political novelist.

What is most striking about Waiting for the Mahatma, perhaps, is the portrayal of Gandhi, who appears in Malgudi to speak to the people, an event that we see from a number of widely differing perspectives. For the authorities this is potentially awkward, as India is at war and the British are anxious about the tide of feeling Gandhi is provoking. At the same time, even those who represent the state are aware of the importance of this man and the resonances of his message of Indian freedom and of love.

Narayan's description of the Mahatma reminds us of just what a remarkable man he was. His portrait is truly arresting because it is painted in exactly the same way that Narayan portrays any of his characters - by showing us the minutiae of their lives. Gandhi walks into the book as anyone might walk through a door: suddenly he is there and we believe unquestioningly that we are in his company.

For a novelist to portray goodness and innocence without preaching or tripping over into sentimentality is difficult. Narayan avoids these pitfalls and presents spiritual values in the clearest but most delicate manner. The theme of the young man on a journey - the innocent abroad, the ambitious dreamer - is also present in Mr Sampath - The Printer of Malgudi. Although this is a highly enjoyable novel, the looseness of structure becomes a bit problematic. It really is two separate stories, the first focusing on Srinivas, the self-published editor of The Banner, a crusading paper with great ambitions, and the second largely concerned with the film industry and Mr Sampath's experience of it. Ambitions of stage and screen are notoriously unlikely to be fulfilled, and as in many of Narayan's novels, you can see disappointment looming well in advance.

Srinivas takes himself very seriously in his writing and yet, like so many of the young men in Malgudi, he is doomed to failure. He is trying to do too much; the world that he lives in is inevitably going to bog him down in its morass. This process of rising up only to be cut down again, is a metaphor, perhaps, for the struggle which the individual faces in India. It is such a complex, crowded country that it is often difficult for a person to achieve what he wants to achieve. There is an immense weight of history, there are just too many people wishing to do the same thing for any one person to get anywhere - or that is how it must sometimes feel.

The Financial Expert is more tightly constructed than the other two. Margayya, the usurer, is a thoroughly unattractive character - a man for whom money is an end in itself and whose life is dedicated to its acquisition. We see him as a small-time facilitator of loans, sitting under a tree with his notebook and inks and the precious loan application forms winkled out of the bank across the road. It is a perfect picture of the financial parasite: the peasants who come to him for advice are manipulated and encouraged into indebtedness, and although they are his bread and butter Margayya treats them with contempt. Indeed, all the money-lender's relationships take second place to his business concerns, and this leads inevitably to the gradual widening of the gulf between him and his family. Balu, his son, who is something of a failure, eventually runs away from home, and is falsely reported to be dead. That at least arouses some emotion in Margayya, but even in his grief he is suspicious of the sympathy extended by his brother, from whom he is also alienated: the offer his brother makes to accompany him to the city to find out what happened is interpreted as an attempt to wangle a free trip to town.

Narayan gives us in The Financial Expert a striking account of the conversion of a mean-spirited person to the single-minded worship of money. Margayya becomes immensely wealthy by enmeshing his clients in ruinous debt agreements and then proceeding to seize their assets. His business dealings are, of course, exploitative and rotten, no more so than when he converts to his own ends Bed Life, the manuscript of the sexual visionary, Dr Pal. Armed with the proceeds of this questionable product, he develops his money-lending business and becomes a respected and influential citizen. Greed, though, triumphs, and his spectacular bankruptcy is achieved when the same Dr Pal triggers a run on his bank. Margayya, of course, has learned no real lessons, and returns to his place under the tree to start afresh.

Narayan is not "preachy". There is a wide variety of human types in his novels, and great deal of bad behaviour. His descriptions of human failings are very matter-of-fact and in some cases almost dry, and yet this does not mean there is no authorial viewpoint. There is, but it is discreet and it is delicately advanced. Narayan is a very unobtrusive writer. He does have a world view, but it is one that is as much anchored in a shared culture as in personal conviction; it is a view linked with a profound understanding of Hindu myths and legends.

These novels can all be seen as reflections of various themes explored in that body of belief, and this lends them a universal significance. In the context of such elemental and ancient legends, it is not surprising that the novelist himself should seem modest and somewhat in the background. And that, in a sense, is the real nature of this great novelist's achievement: the portrayal of the world and its great themes through the depiction of the minutiae of life. Narayan does not start with a generalisation, with a theory; he lets his characters demonstrate to us, through their very ordinary thoughts and actions, what it is to be human. And to do this he stands in the crowded streets, in the houses, in the workplaces, listening to the things that people say, the small things, the poignant things, the laughable things; listening and taking notes.

· This is an extract from Alexander McCall Smith's introduction to Mr Sampeth - the printer of Malgudi, The Financial Expert and Waiting for the Mahatma published in one volume by Everyman on Thursday price £10.99. To order a copy for £9.99 with free UK p&p call Guardian book service on 0870 836 0875.