As a history teacher, I encounter bright students who know nothing about World War I but everything about the Battle of Pelennor Fields and other details of J.R.R. Tolkien's Middle-earth. I feign outrage at their ignorance, taking advantage of a teachable moment. Deep down, however, I empathize. Historians, after all, spend their professional lives inhabiting virtual worlds of the imagination. These worlds are nonfictional, based on available evidence, but the imaginary realms of modern fantasy are usually not far removed from the most carefully researched works of history. They too use the tools of the historian's trade in their meticulous creation of worlds of wonder, such as footnotes, maps, appendices, chronologies and glossaries.

Imaginary worlds in other media have a similar rational glamour. "World of Warcraft" could just as well be called a world of math-craft, as players ponder the numerical levels of their virtual character's attributes, spells, and possessions. And anyone who has ever played, or even observed, a game of Dungeons & Dragons will never forget that most intimidating of mathematical objects, the twenty-sided dice.

All of this sounds like a lot of work, of the "dry and dusty" sort that people associate with academia. Why, then, are modern imaginary worlds usually more popular than actual historical worlds - and not despite their scholarly baggage, but because of it?

This was one of the questions I set out to answer in "As If: Modern Enchantment and the Literary Prehistory of Virtual Reality" [Oxford University Press, $27.95]. It was also a question that preoccupied Tolkien, who in addition to being a renowned creator of imaginary worlds was a brilliant analyst of them. He realized that contemporary readers craved wonders and mysteries, which the scientific and materialist outlook of the modern world marginalized; they yearned for enchantment in a disenchanted age. But not any type of marvels would do. To be acceptable to a modern audience schooled in the primacy of reason, fantasy worlds had to be as rigorously logical, and as empirically detailed, as a national census that just happened to include Orcs, Balrogs, and Ents as part of its survey. "Fantasy is a rational not an irrational activity," Tolkien argued. "The keener and the clearer is the reason, the better fantasy will it make."

Arthur Conan Doyle's Sherlock Holmes also represented this form of rational enchantment by making reason itself a magical process that did not resort to magic, which is the main reason for his lasting appeal. Toward the end of his life, Conan Doyle disappointed many fans of the logical detective by embracing Spiritualism. He undoubtedly would have exasperated Holmes as well, given Holmes's declaration that "This world is big enough for us. No ghosts need apply." Holmes's fans mocked Conan Doyle's belief in fairies, while they ironically "believed" in Sherlock Holmes.

Of course the "The Lord of the Rings," for all of its rich detail, is nothing like a census. (Tolkien's posthumously published "The Silmarillion," on the other hand, has been likened to a telephone directory written in Elvish.) His realist narrative of wonder was crafted to combine the appeal of ancient myths with the existentialist dilemmas of modern novels. Ordinary folk strive alongside extraordinary heroes against hopeless odds and terrible setbacks. Tolkien also knew how to increase his readers' investment in Middle-earth by alluding to events in its history not covered within The Lord of the Rings. This tactic gave his imaginary world even more depth and allure. He recognized that such tantalizing hints would lead readers to scrutinize the world for clues about their meaning, heightening their engagement in the process.

Conan Doyle would have agreed with Tolkien's claim that "a story must be told or there'll be no story, yet it is the untold stories that are the most moving." In the sixty narratives of the Holmes "Canon" (or, as some prefer, the "Conan"), Dr. Watson provocatively mentions the titles of cases that many implored Conan Doyle to write, including one about "the giant rat of Sumatra, a story for which the world is not yet prepared." The power of untold stories to both entice and frustrate is so great that many fans have written their own versions. (In the unfortunate case of George R.R. Martin, fans have harried him to answer questions about "The Game of Thrones" and its sequels that disturb their peace, disturbing his own in the process.)

These are some of the reasons I found for why modern imaginary worlds are so appealing, even addictive. Yet contemporary works of history are also logically structured and richly detailed; in their recreation of other times and places they too offer cohesive worlds of wonder. Why then is it such a challenge to get students interested in the history of the real world, while they can readily teach many of us more than a thing or two about imaginary worlds?

The answer is complex, but the most basic reason has to do with the issue of control. History is about structures and patterns, but it's also about the effects of chance and contingency. It reminds us of how our lives are susceptible to occurrences beyond our command. Imaginary worlds, on the other hand, offer the comforting illusion of control: Middle-earth and the London of Sherlock Holmes are stable territories of the imagination, welcome refuges from the uncertainties of modern life. We can master them in a way we can never master genuine history.

Like my students, I'd rather read about the Battle of Pelennor Fields than the Battle of the Somme. But as Tolkien insisted, the modern enchantments of imaginary worlds are complements to reality, never a replacement for it. He had fought at the Somme, and his traumatic experiences are at the heart of "The Lord of the Rings." Perhaps his merging of the two worlds is the ultimate secret of its tremendous success.

