A couple of weeks ago, Frank Lean drove his modest family saloon into a petrol station near the secondary school in central Manchester where he teaches. As he attended to the unleaded, a BMW, white and spanking new, sleeked in next to him. The reflective windows purred down and the car's driver, no more than 19, acknowledged him with a cheery 'all right, Sir?' It was a former pupil.

'There he was with a blonde in the passenger seat and all the flash in the world,' said Mr Lean. 'There is only one way a kid like that round here could afford a new BMW. So I guess he didn't need our careers advice that much.'

Frank Lean's school can be found at the apex of a triangle formed by Moss Side, Hulme and Whalley Range. You can't miss it: drive past the pub that was visited recently by two locals who stood atop the bar and sprayed the ceiling with small arms fire, then turn off the main road where fierce-looking prostitutes patrol their turf night and day.

Inside it may appear to be much like any other school, colourful pictures on the wall, shouty second- years filling the corridors with cheek. But, despite Frank Lean's protestations that it is 'no more than a representative inner-city school with typical inner-city educational problems', not many such establishments have former pupils shot dead in broad daylight in nearby shopping centres.

'He was a drug dealer,' Mr Lean said, sitting in the small office he occupies as head of the lower school. 'But the way he was hunted down was dreadful. He was chased through the cul-de-sacs and crescents round here by a posse of youths on mountain bikes and then cornered outside a supermarket. What really chilled me, there were 30 witnesses and none would testify. What you have round here is escalating violence. Vendetta culture.'

It is no surprise to discover, with a day job like his, that Mr Lean's moonlight occupation involves gangs, murder and drugs. He writes urban crime fiction, gritty, violent stuff featuring teenage hoods, gun- toting gangsters, club owners with a taste for trouble, the kind of thing he didn't have to go far to research.

'I'd always been a big consumer of crime fiction, and I thought I could do as well. The genre tends to be set in American cities, so I thought, why not write about Manchester? We've got the scene here. There's enough material for any crime fiction round my corner, I'd have thought.'

The result was Red For Rachel, a thriller published this week (Mandarin, pounds 4.99), which includes lines not often found in detective fiction, such as: 'They drove down Medlock Street and on to Princess Road and the Parkway. At the end of the Parkway they turned on to the M56 for a couple of miles . . .'

'It wasn't difficult to come up with the plot,' said Mr Lean, whose book took him a year, writing in his holidays. 'If you have any imagination, you only have to drive round Manchester to see what's happening.'

So we did. Out of the school gates, past the shot-up pub, past the hookers plying their trade as children made their way home for the day. Into Moss Side, where dozens of the neat little new terraced houses are boarded up or burnt out, past the spot where the father of one of his pupils was stabbed to death last month.

'Until a couple of weeks ago I would have said it was perfectly safe to drive round here in broad daylight,' said Lean, turning into a road where the local health centre is barricaded against drug burglars like a medical version of Fort Knox. 'My wife and I were driving through here on our way home when this car jumped a red light at about 90mph, followed by three police cars with sirens wailing. They missed us by a quarter of an inch.'

We decided to get out and walk round. Three boys dressed in fancy trainers, lumber jackets and too- long jeans - top gear - wandered past, gobbing and demanding to have their photos taken. They were no more than six. A gaggle of teenage girls, weighed down by jewellery, their hair teased into absurd rolls, walked by and said 'hello, Sir' to their former teacher.

We didn't see any shoot-outs, mountain-bike madmen or drug deals conducted under the noses of watching police, but you could see what he meant. An area rebuilt less than five years ago and already heading for dereliction looks a likely setting for a thriller.

Not likely enough for the Manchester magazine City Life, though, which last month ran a stinging critique of Mr Lean. The suggestion was that a history graduate from Keele University who lives in a semi in Chorlton with his wife and five children is in no position to know what is really going on in Moss Side. And had no right to make a financially beneficial fiction of it anyway.

'I was surprised how hurt I was by their criticism,' Mr Lean admits. 'When you are a teacher and you do a good lesson, nobody says to you afterwards, 'what a good lesson'. Part of the impulse in writing is to put your head over the parapet and see whether anyone likes what you are doing. It was a shock to be shot down immediately.'

He accepts that his depiction of youth gangs in Red For Rachel is not based on direct experience - the episode when his hero escapes from Uzi-toting lads with his wrist still handcuffed to a radiator is, for instance, entirely made up. But he defends his research resolutely.

'I do think that my work in the school has given me an insight into how these characters interact. I talk to these children, I counsel them. I met many of the big criminals in this area when they were lawless little beggars. There was a family of six boys who passed through our school, who now form the core of the gang who run Cheetham Hill - the area they call Baby Beirut.'

Back at his school, patrolling the place after the pupils had gone home for the evening, Mr Lean said that if Red For Rachel becomes a mega-seller, and his hero, David Cunane, is thrust on to television to rival Spender in Newcastle, Taggart in Glasgow or Morse in Oxford, he would not abandon his day-job mixing with his material.

'Some of these social undesirables, they have a redeeming side, they are not easily put down,' he said, sitting in a classroom with evidence of a French lesson on the blackboard. 'They're natural resisters, grit in the machinery in school and in society as a whole. But the ingenuity and resource they show in circumventing rules is a very attractive quality. If we had a dictatorship in this country, they would be the first to rise up.'

Besides, he added, double-locking his office door, it is a challenge to teach them.

'We try to educate the children away from the glamour and the easy money available in the drugs culture,' he said. 'We try to keep a strong Christian ethos, but we have children coming here who have a very different ethos, who are socialised into crime from an early age. Our contact with them is marginal to say the least. But there are kids from this school who have gone on to be doctors, policemen, missionaries. I guess the lad who got himself shot rejected our moral effort.'

(Photograph omitted)