It was in my teenage years that I first encountered the novels of Raymond Chandler. From childhood onwards I had been keen on crime fiction: like many boys I was fascinated by puzzles, eager to find out everything I could about adult passions, and unslakeably bloodthirsty. I liked in particular the Queens of Crime, that regiment of murderous ladies in flowered frocks, as I pictured them: Agatha Christie, of course, Margery Allingham, Josephine Tey, Ngaio Marsh, Georgette Heyer, and Dorothy L Sayers. Their brand of polite murder mystery, perfectly characterised in the title of WH Auden's 1948 essay "The Guilty Vicarage", provided a frequently unacknowledged but vital ingredient of a really satisfying whodunnit: cosiness.

Chandler offered something original and exciting. Philip Marlowe was a new kind of detective – poised and articulate, dry as a dry martini, as witty as Thurber and as disenchanted as Scott Fitzgerald – but there was also a quality to these novels I had not encountered before in crime fiction. Although I would hardly have been able to articulate the thought at the time, what I found most attractive in Chandler's work was the sumptuousness of the prose style. Even when the streets that Marlowe was obliged to go down were the meanest, the language in which they were described was rich in metaphor, at once sensuous and crisp, and marvellously redolent of mid-century California, a place and a time we all thought we were familiar with from the movies.

"The most durable thing in writing is style," Chandler wrote in a letter to a literary agent in 1945. In this assertion and others like it he was laying claim to his place on Parnassus, if on one of the lower slopes. Flaubert and Joyce complained frequently and loudly of having no choice but to scatter the gold coinage of their prose over the base metal of mere mortal doings, and Chandler too, in his less emphatic, more sardonic, way, sought to set himself among the gods of pure language, pure style.

Like the bard of Bay City, the French and Irish masters of realist fiction frequently professed to care nothing for content and everything for form – and form, of course, was just another word for style. Writing to one of his numerous correspondents, Chandler insisted that "the only writers left who have anything to say are those who write about practically nothing and monkey around with odd ways of doing it". Out of their grand indifference, however, Flaubert created Emma Bovary and Frédéric Moreau, and Joyce Leopold Bloom and Stephen Dedalus; and Chandler, not to be outdone, gave us Marlowe, the private eye of private eyes, who is among the immortals.

Who was Chandler, where did he come from, and what formed him? Marlowe was a quintessential native Californian, but Chandler decidedly was not. He was born in Chicago in 1888, into a Quaker family of Irish origins – by coincidence, his mother Florence was born in Waterford, the same Irish city from which his father's people had emigrated to America earlier in the 19th century.

Maurice Chandler worked for the railroad, was an alcoholic and, if his son is to be believed, a waster, who abandoned his wife and son. In 1900 Florence Chandler transferred young Raymond and herself to Britain. Chandler attended Dulwich College, which lists PG Wodehouse among its old boys. "A classical education," Chandler later wrote, "saves you from being fooled by pretentiousness, which is what current fiction is too full of."

He had hopes of becoming a barrister, but could not afford to go to university. However, his Waterford uncle, Ernest Thornton – a name that should have a place of honour in the annals of American literature – offered to send him to Europe for a year, to study French and German and to some degree to finish his education. Chandler spent time in Paris, Munich, Nuremberg and Vienna. At the end of this Wanderjahr he returned to London and became a journalist, not very satisfactorily. Later he forsook the newspapers for a job in the civil service, with an equal lack of satisfaction. He also began to write poetry.

All this seems hardly the typical apprenticeship of a crime writer, and certainly not of one who began his career by churning out hard-boiled stories for Black Mask and other pulp magazines that were so popular at the time. But then crime writing was a last resort for him. All his life he not only felt himself out of place geographically and socially – "a man without a country", as he said of himself – but considered that the writing work he was doing was beneath him, even in the years when he was receiving critical acclaim – Auden and Evelyn Waugh were among those who recognised his talent and originality – and earning a lot of money. He was ever on the lookout for slights, and in his letters never misses an opportunity to take a swipe at the highbrow critics, especially Edmund Wilson, his abiding bête noir.

Despairing of making a life for himself in Britain, and all but abandoning his ambitions to be a poet and essayist, he appealed again to Uncle Ernest over in Waterford, pledging that if Ernest would lend him £500 he would never press again on that sainted gentleman's generosity. Ernest, spotting an offer that even if he could he would be ill-advised to refuse, agreed. "On 10 July 1912," his latest biographer, Tom Williams, writes, "Raymond Chandler boarded the SS Merion at Liverpool. He was wearing a tailored suit, carrying his silver-tipped cane, and had $40 in his pocket. He was heading to America." He stopped in Nebraska for a while, scratching a living from odd jobs, then crossed the Rockies and landed at last on that tawny strip of coastline that, with a few intermittences, would be his home, however uneasily, for the rest of his life.

In Los Angeles he worked as a bookkeeper, of all things, in a creamery, of all places. Then, in 1917, he enlisted in the Canadian army, which, unlike the US army, would provide his mother with a stipend to live on while her son was serving abroad. In France he fought in the trenches, an experience that marked him – indeed, scarred him – for life. "Once you have had to lead a platoon into direct machine-gun fire, nothing is ever the same again," he said. After the war he once more worked in various jobs, the most long-lasting of which was with an oil company, from which he was dismissed in 1933 for drunkenness, absenteeism and moral turpitude – he had an eye, and more than an eye, for the secretaries. It was to be a long while before he came back to writing: his first detective story, "Blackmailers Don't Shoot", was published in Black Mask in 1933, while his first novel, and his first masterpiece, The Big Sleep, did not appear until 1939, when he was 50.

What was the cause of this fecklessness and restless discontent? More to the point, what was it that drove him to drink? Here the question of sex rears its androgynous head, and a very loaded question it is. Some readers have detected strains of misogyny in his work, and certainly his attitude to women is guarded, to say the least – I think I am right in saying that in every one of the Marlowe novels the killer turns out to be a woman. His wife Cissy was 18 years older than he was, which meant she was only nine years younger than his mother. There is no doubt that he loved Cissy, and that he was devastated by her death, yet it seems to have been a distinctly peculiar marriage; but then, what marriage is not?

Commentators have also pointed to traces of homoeroticism in the work. My friend the Chilean novelist Rodrigo Fresán suggests that the only person Marlowe ever really loved was Terry Lennox, the friend who betrayed him in what many consider to be Chandler's finest novel, The Long Goodbye. We should keep in mind, however, that Chandler was a man of his time, a time in which women were women and men as often as not turned out to be Rock Hudson, and everyone tossed throwaway insults at "frails" – women, that is – effeminate men, black people and Jews. It does not make it right that everyone was doing it, but all the same, everyone was doing it.

Chandler wrote, in the same letter quoted from above, that he was "fundamentally rather uninterested in plot" – that "rather" is an example of those jaded little Englishisms he frequently affected – and returned to the theme of the supremacy of style: "The most durable thing in writing is style, and style is the most valuable investment a writer can make with his time." Here he was, surely unconsciously, echoing Henry James, who in his notebooks reminded himself that "In literature we move through a blest world in which we know nothing except by style, but in which also everything is saved by it."

What Chandler was after, he said, was "richness of texture". He pointed out that he "wrote pulp stories with as much care as slick stories [ie stories for literary magazines] … I obeyed the formula because I honestly liked it, but I was always trying to stretch it, trying to get in bits of peripheral writing which were not necessary but which I felt would have a subconscious effect even on the semi-literate readers." This is an artist speaking, and it was Chandler's achievement to lift the crime genre to the level of art – not high art, perhaps, which part of him disdained, but art all the same.

He tried not to be pretentious. In "The Guilty Vicarage" Auden had singled him out for praise, which provoked an outburst of false modesty. "Auden leaves me lost and groping. His piece about detective stories was brilliant in the clear cold classical manner. But why drag me in? I'm just a fellow who jacked up a few pulp novelettes into book form." Further on in the same letter, however, complaining that pulp-magazine editors would always take out descriptive passages because readers did not appreciate that kind of thing, he comes up with this wonderful encapsulation of his aims and his methods:

"And I set out to prove them wrong. My theory was they just thought they cared nothing about anything but the action; that really, although they didn't know it, they cared very little about the action. The things they really cared about, and that I cared about, were the creation of emotion through dialogue and description; the things they remembered, that haunted them, were not for example that a man got killed, but that in the moment of his death he was trying to pick a paper clip up off the polished surface of a desk, and it kept slipping away from him, so that there was a look of strain on his face and his mouth was half open in a kind of tormented grin, and the last thing in the world he thought about was death. He didn't even hear death knock on the door. That damn little paper clip kept slipping away from his fingers and he just wouldn't push it to the edge of the desk and catch it as it fell."

When my agent, Ed Victor, who represents the Chandler estate, first approached me with the suggestion that I might write a Philip Marlowe novel, I hesitated for a long time. Should I, an Irishman in the second decade of the 21st century, attempt to follow on from an iconic and much-loved writer whose first novel was published six years before I was born? There was much to daunt me. Could I invent a plot to match the master's fiendishly intricate mysteries? Would I be able to catch anything of the flavour of postwar Los Angeles, the accents, the atmosphere, the acrid feel of a time and place so specific to the Marlowe books? Above all, would I be able to reinvent a convincing Marlowe?

I went back to the novels, of course, but also to the essays and the letters – especially the letters – and felt the pull of an irresistible affinity. Good crime writing is as difficult as any other kind, and, in its way, just as rewarding. In The Black-Eyed Blonde – one of a list of possible titles that Chandler drew up, and which I was happy to borrow from – I have sought not to parrot Chandler, but to honour the spirit, vigorous, valiant and melancholy, of this master of English prose. And now I wish I could meet up with him in some shady bar on Sunset, slide on to the stool beside him, give him a light for his cigarette and buy him a gin gimlet, and ask him how I did.

• To order The Black-Eyed Blonde by John Banville (writing as Benjamin Black) for £13.59 with free UK p&p call Guardian book service on 0330 333 6846 or go to guardianbookshop.co.uk.