By Elmore Leonard; Elmore Leonard's most recent novels are ''Stick'' and ''LaBrava'' 

Published: February 5, 1984

At sundown, as Lieut. Burl Richard Snider of the San Diego Police watched from a hillside, the illegal aliens would appear as though out of the earth. Several thousand a week they crossed into the scrub no man's land north of the line, into Smuggler's Gulch, Deadman's Canyon, wary of ''La Migra,'' the United States Border Patrol. And there were nights Dick Snider would hear their screams as Tijuana bandits robbed them, raped women, murdered without purpose.

The police officer accepted the fact the Mexicans were unwanted, but that didn't mean he was going to stand by and see them brutalized. A familiar Joseph Wambaugh theme begins to take shape. In ''The Delta Star,'' Mario Villalobos shouted, ''Khofu killed ten thousand slaves to become immortal. . . . But I'll tell you something, mister - he didn't do it on my beat!'' In ''Lines and Shadows,'' a true story, Lieutenant Snider echoes the refrain. Innocent people, regardless of their status, are not going to be robbed and murdered ''In my city. In my country.''

In the fall of 1976, Lieutenant Snider organized the Border Crime Task Force, recruited 10 San Diego police officers under Sgt. Jesus Manuel Lopez - eight of them Mexican-American - and sent them out heavily armed to stop the bandits. The experiment continued for 18 months, highly controversial to the end. What rules were these guys playing by? Were they cops doing a job or vigilantes?

Media darlings, stars of the 11 o'clock news, they were called ''the Last of the Gunslingers.'' ''Could a journalist resist? Think of it: ten little hardball lawmen, shooting down Mexican bandits. . . . If that wasn't a John Ford scenario, what the hell was it?''

In the hands of Joseph Wambaugh, it's much more than blazing pistols in the dead of night. For starters, no one writes about cops better than Mr. Wambaugh, and the cops love his books. (I've never met one who didn't.) To civilians, his cops are almost all crazy, ranging from mildly weird to highly explosive. In real life, police officers appear no more colorful or eccentric than the rest of the population. But Mr. Wambaugh is a storyteller, and you don't tell stories about boring people. Not when you've got real-life San Diego cops who dress like illegal aliens, strap on three revolvers or a .38 and a sawed-off 12-gauge and then go out into a pitch-dark wasteland to have gunfights with heroin-addicted thugs whose infected needle tracks smell of death.

It would have to be an unusual type of police officer who would even consider doing it. The angle Mr. Wambaugh develops, brings into dramatic focus, in ''Lines and Shadows'' is that if a cop is this unusual type, willing to put his life on the line night after night, he is going to experience a drastic change. It's just too hard to come down, to act normal with the wife and kids. How can he? He's a celebrity. The local politicians, the press, the Rotary Club all love him. The Gunslinger groupies who flock to the Anchor Inn worship him.

Even if he wanted to come down and act normal, Sergeant Lopez wouldn't allow it. Manny the hard charger, who could throw down five shots of mescal in less than a minute and stalked bandits as though he were immortal - he was the personification of machismo, and he scared hell out of his own men. When the experiment was over, one of them said, ''We're all afraid of psychotics, aren't we? We're terrified of unpredictable lucky psychotics.''

It doesn't matter which side they're on.

With each book, it seems, Mr. Wambaugh's skill as a writer increases. His confidence shows in the range of his writing style, his ability to move from clear exposition into a rush of highly dramatic prose and remain in control.

At the time Mr. Wambaugh published ''The Choirboys'' in 1975, I remember thinking there's no need for anyone to write another police story ever again; this guy has said it all. Well, he's written three best sellers since then, and now in ''Lines and Shadows'' he gives us an off-trail, action-packed true account of police work and the intimate lives of policemen that, for my money, is his best book yet.