Apart from his mind-bending, eye-opening, intellectually challenging short stories—the best known are collected in Labyrinths and Ficciones—what makes the great Argentinian writer Jorge Louis Borges one of my favorites is his admiration for detective stories. I’m used to crime fiction being sectioned off in its own category—set apart on bookstore shelves, away from general or literary fiction, and reviewed separately in magazines and on websites. The implication seems to be that as genre fiction, crime fiction is somehow inferior to other forms of literature. Even in Murder Mystery, the new Netflix film that’s a send-up of the genre’s formulaic requirements, the boneheaded policeman played by Adam Sandler feels free to make fun of his wife’s love of mystery novels. “The butler did it,” he says to Jennifer Aniston’s character while she is reading—as if “whodunnit” is all you need to know. If that were the case, most crime novels would be just a few chapters long, and the popularity of the genre would long ago have run its course.

In one of several essays on detective fiction, Borges observes that just as Oscar Wilde pointed out that the various rule-bound forms of poetry “prevent literature from being at the mercy of genius,” the rules of crime fiction impose certain obligations on its writers. “Whether mediocre or awful,” he writes, “the detective story is never without a beginning, a plot and a denouement. The literature of our times is exhausted by interjections and opinions… the detective story represents order and the obligation to invent.”

I take Borges’s point about the detective story’s obligation to invent to mean that the detective fiction is always under pressure to deliver something to its readers. That something, as Borges puts it, includes a beginning, a plot and denouement. And that is what keeps readers coming back to crime fiction, whether it’s classic mysteries, procedurals, spy novels, historicals, or thrillers. It’s the enjoyment of the ride, the roadblocks and settings and twists and turns, and not simply to find out whether or not the butler did it, although that is part of the fun. (Murder Mystery realizes this too, and despite being panned by critics, this breezy riff on Agatha Christie–style mysteries was viewed by a record 31 million accounts in its first three days.)

I was delighted, recently, to come across A Universal History of Iniquity, a slim volume of Borges’s fictional essays on shady characters from the past, written in the 1930s. In A Universal History, inspired by Robert Louis Stevenson and G. K. Chesterton’s Father Brown detective stories, Borges created fictional biographies for thugs like Monk Eastman and Bill Harrigan (Billy the Kid), “The Widow Ching—Pirate,” “The Improbable Imposter Tom Castro,” and others. And forget beginnings or denouements; Borges conveys more in a single sentence than most writers can in a paragraph.

After an all-night gun battle on Rivington Street in “Monk Eastman, Purveyor of Iniquities”: “[W]hat remained were seven men gravely wounded, four men dead and one lifeless pigeon.” And in “Tom Castro,” Tom meets his future accomplice, Ebenezer Bogle, who is described as a man who was normal in every way, except for “a deep-seated and shamefaced fear, that made him hesitate at street corners and at crossings, survey east, west, north and south, and try to outguess the violent vehicle that he was certain would end his days.”

The stories were first published in the pages of the sensationalist Buenos Aires newspaper Critica, which had hired Borges as an editor and writer in order to upgrade its image and give its literary section a highbrow tone. Most of his pieces for the publication were straightforward cultural criticism and essays, and his insertion of these “penny-dreadful-style” tales must have caused some confusion for his readers. But the juxtaposition was, as Andrew Hurley writes in his introduction to A Universal History, an early marker of Borges’s “odd duality of high seriousness and fun.”

I’d argue that crime fiction shares this duality. High seriousness because it deals with questions of life and death and violence; fun, even in the grittiest novels, because the pleasure of reading consists in seeing what the author does with the form. Generally speaking, all crime writing does at least two things at once—it tells the story of a crime that has occurred (key details of which are unknown to the reader) and it tells the story of the investigation that brings those key details to light. And readers of crime fiction are doing at least three things at once—following the story that’s being told, trying to come up with our own solutions or predictions based on the world that’s been created—and based on our prior experiences with the genre. Even if we don’t realize it, as readers of crime fiction our reading experience is always filtered through our understanding of whether or not the particular narrative we happen to be in the midst of is going to stick to the rules, or break them, or bend them, and if so how.

The distinction between highbrow and lowbrow has always felt arbitrary to me. And it is perhaps the accessibility of crime fiction—thanks precisely to its genre constraints—that obscures the sophistication involved in writing even the simplest crime story, and the sophistication involved in reading one. Those who dismiss the genre often do so because its accessibility and popularity make it suspect. Yet, as Borges observed, constraints spur creativity. And when crime fiction is at its best, the distinction between it and literature vanishes.

Mystery correspondent Radha Vatsal is the author of A Front Page Affair and Murder Between the Lines.