(HBO)

All Westerns are stories of people attempting to impose order on a chaotic, lawless, and savage environment. Deadwood, the HBO series that aired from 2004 until 2006, derived tremendous narrative power by exploring the moral quandaries that arise in such circumstances. In the show, otherwise good people lie, commit sabotage, sell drugs (and their bodies), and kill -- just as they did during the 1870s in the real Deadwood, the mining town in present-day South Dakota from which the series took its name.

Beyond thematic verisimilitude, Deadwood's creator, David Milch, also strove for more mundane historical accuracy, the best-known example being the show's remarkably profane dialogue. Many of the main characters are based on real people: Seth Bullock, the sheriff; Al Swearengen, the saloon and brothel owner; E. B. Farnum, the hotel keeper; Wild Bill Hickok, the celebrity sharpshooter killed during a poker game in Deadwood; and Calamity Jane, the gender-bending, gun-toting scout. But the daily realities for these historical figures are invented. The result is a rich, almost epic tale -- "like some fucking great Greek battle," as Farnum describes the state of affairs at the beginning of the second season. But accurate? Not so much.

Of course, audiences should not expect Westerns to be lessons on how people cursed or dressed or died on the frontier. Imposing the rules of history on the genre would mire its grander themes in the mud of hardship and disappointment that covered ordinary life in the Old West. Meanwhile, Deadwood, compelling as it is, only gestures at the historical forces that shaped the real-world Old West: military conquest, industrialization, and ethnic conflict. Complex phenomena such as those undercut the notion of the individual taking control of his or her own destiny, a trope at the heart of every Western.

NOBLE SAVAGES

To its credit, Deadwood avoids one of the worst offenses of the Western genre. Most Westerns misleadingly present the natural state of the frontier as chaos, a disorder that existed until American law, ethics, and above all, capital rendered it orderly. In reality, the disorder was created when settlers arrived on Native American lands, whose original inhabitants had previously led reasonably well-ordered lives. In the Dakotas and scores of other places in the U.S. West, the root of the trouble was not a Hobbesian state of nature but rather the encroachment of the state, or at least its weak nineteenth-century form. Although Deadwood does not dwell on this reality, it at least recognizes it, unlike most Westerns.

In Deadwood, as in history, the trouble in the Black Hills region stemmed from the fact that the U.S. Army was not strong enough to repel illegal squatters -- a term that applied to all the non-native settlers in the region -- or to deter natives from attacking the Americans who had invaded their land. Moreover, the weak machinery of the U.S. government could not establish genuine rule of law: It could not build roads, round up lawbreakers, or enforce mining regulations. This vacuum of authority -- and not the "savagery" of the land's original inhabitants -- precipitated the violent conflict that frequently consumed places like Deadwood.

For the Lakota and other plains people, the Black Hills region offered protection and food when things got bad -- and the 1860s and 1870s were bad times. Even as treaty after treaty between native tribes and the United States had reduced Native Americans' land, other agreements had guaranteed that the Black Hills would remain in Lakota hands. When white miners illegally invaded the area in the early 1870s, they did so knowing that the U.S. government forbade it. Still, when gold was discovered there, no army or government could keep the invaders out, or keep the original inhabitants from fighting to protect their homeland. As miners and Lakota attacked and killed one another, various government commissions tried to persuade the Lakota to sell their mineral rights. But the tribe flatly refused, insisting that the government remove the illegal miners.

In 1876, the government turned to the army, whose solution was to send one of its most infamous officers, George Armstrong Custer, to confront the Lakota tribe and its allies. Custer was killed, along with nearly all of his men, at the Battle of Little Bighorn, prompting U.S. President Ulysses Grant to dispatch a "peace commission" consisting of federal and territorial officials and representatives from mining and railroad interests. After a combination of threats and bribery, the commissioners obtained the signatures of a number of war-weary tribal leaders on a new treaty opening the Black Hills to U.S. miners.

The U.S. Army, which had tried to protect native lands from white invasion, now had a different charge: to force the tribes to gather on reservations, in accord with the Black Hills Act of 1877, which completely stripped the Lakota of their claim to the area. (The Lakota protested that they had signed away only their mineral rights, and a century later the U.S. Supreme Court vindicated their position and forced the U.S. government to compensate the tribe for the stolen land.)

The action in Deadwood picks up as the negotiations between the government and Lakota are under way. In barrooms and on stagecoaches, the settlement's inhabitants whisper rumors of Native American attacks and speculate about who might get their land when the conflict ends. However, native people play only a small, mostly off-camera role in Deadwood. They lurk in the background, perceived by most of the main characters as crazed misfits who can be blamed for anything bad that happens in the community.

One of Deadwood's best qualities is the depth and subtlety of the human relationships it portrays. But the show's one depiction of an interaction between a white settler and a Native American is shallow and heavy-handed. In an early episode, Bullock, the earnest lawman, unwittingly rides his horse into a graveyard, where a tomahawk-wielding Sioux assaults him. The man shoots Bullock's horse and attacks Bullock with a club. Believing that the lawman is dead, the Sioux seems distraught and performs some kind of ritualistic dance; the suggestion is that he did not want to kill Bullock and, perhaps by extension, that Native Americans in general did not really want to kill anyone. A Lakota man might have made some kind of ritualistic display after vanquishing an enemy but not the mournful (and rather ridiculous) hooting and dancing that the show depicts. Bullock regains consciousness and bashes the Sioux's head with a rock, killing him. The episode ends with Bullock placing the dead man's body on a native burial platform, an act of cultural sensitivity that might endear the character to twenty-first-century viewers but would have been highly unlikely in the 1870s.

That scene is the series' only depiction of a living native person. (For reasons that are never quite clear, Swearengen, the powerful saloon and brothel owner who is the show's crafty antihero, sometimes converses with the severed head of a chief that he keeps in a box.) As in most Westerns, Native Americans ride in to provide historical flavor but seem to have no present or future.

GILDED-AGE GUNSLINGERS

Deadwood does a better job of portraying other political themes of the West in the 1870s: veterans recovering from the Civil War, deep-seated racism, and a breathtaking level of graft and fraud in government, which was lampooned by Mark Twain and Charles Dudley Warner in their 1873 novel, The Gilded Age. The Dakota Territory, established in 1861, quickly earned a reputation for public corruption. The territory's governor and other high officials were appointed by the president, rather than elected. The intention was to prevent anyone with local interests from holding these offices; in practice, powerful businesses such as railroads and mines simply purchased the governorships from the Grant White House. William Alanson Howard, who served as governor from 1878 to 1880, had a convenient day job supervising land surveys and purchases for the Northern Pacific Railroad. Edwin Stanton McCook held the office briefly in 1873 while also sitting on the boards of trustees of several mining companies, a conflict of interest that was resolved only when McCook was assassinated by what local newspapers labeled a "disgruntled constituent" in a saloon in Yankton, the territory's capital city. It is no wonder that the fictional Swearengen does not want any "Yankton cocksuckers" to decide who can hold office or validate the title to his mining claim.

No characters on Deadwood are without sin; instead of morality, what sometimes seems to distinguish the good guys from the bad guys are their opposing views on the proper role of government. Civic-minded Bullock and his deputy, Charlie Utter, want some kind of central authority to meet the community's collective need for hospitals, sidewalks, and schools. In contrast, the greedy brothel owner Swearengen and the hapless suck-up Farnum view government as little more than a conduit for bribes. This dim view of central authority lives on in Western mining towns. Although their cities and towns require federal Superfunds to clean up their water and state tourism grants to attract visitors, local potentates still look at taxation and government authority with a jaundiced eye.

THE INDUSTRIAL FRONTIER

Deadwood's portrayal of life in a Western outpost in the 1870s is decidedly unromantic. Everything is covered in thick mud. The food is all spoiled. The streets are soaked with sewage and vomit. Innocent children are trampled to death by loose horses. Everyone has bad teeth.

But the show also misses the essentially industrial nature of such places. Deadwood was founded in 1875, as was Lead, a town about two miles southwest. By 1876, when the series begins, both towns were booming, teeming with men experienced in highly profitable deep-lode mining. Many of the miners had previously worked at the highly industrialized Comstock Lode in Nevada, where labor unions had won the right to eight-hour shifts. Their efforts followed the deaths of too many men who collapsed from laboring in the 130-degree temperatures common in the deep, wet mines. Union demands -- and union-backed violence -- also protected a wage of $4 per day, one of the highest in the nation. Miners in the Dakota rush formed unions instantly, drawing up demands based on those made by the Comstock unions.

But by 1877, when the second season begins, major industrialists had already established themselves as the real power players in the Dakota Territory. One of the most fascinating characters in Deadwood is the mining magnate George Hearst, who owned the Homestake Mine in Lead. Most of the $500 million in gold produced in the Black Hills region between 1869 and 1900 came from this single mine. In Deadwood, Hearst is portrayed as a creepy madman who terrifies his employees, destroys his own buildings to keep anyone from living near him, and tolerates a serial killer as his second-in-command. The real Hearst was a less eccentric figure but no less intimidating. His was the largest and longest-running mining corporation in the American West. It succeeded by implementing vertical integration, handling every aspect of gold production, from mining to milling, from prospecting to shipping. Company officials hired Pinkerton agents to bust unions and make sure no one outside the company held political office.

In Deadwood, Hearst battles mightily to gain control of every facet of the town, but the plucky little community and its unlikely cast of pimps, newspapermen, drunks, whores, and uptight teachers manages to outsmart him. Yet in the final episode, Milch and his collaborators hint at the way things actually turned out: Hearst won. The real Deadwood and Lead, and perhaps all of Dakota, remained in the hands of the mining magnates. Mining did not offer the little guy a chance to strike it rich but only the grim reality of working underground in horrific conditions for a modest wage.

THE REAL DEADWOOD

If you want to visit the "real" Deadwood, forget about the tourist-trap casinos that represent the town's risky economy today and instead head to the Mount Moriah cemetery. The names on the gravestones hint at messy human connections that give a community its stories. Wild Bill Hickok is buried there next to his friend Calamity Jane. So are three infants born to one Wing Tsue, a longtime resident of Deadwood's Chinatown, which is depicted in the HBO series as a sort of Chinese twin to the American settlement, complete with its own earnest strivers, ne'er-do-wells, and violent crazies.

The graves in Mount Moriah offer silent testimony to the human cost of getting gold out of the ground. The details of the lives of those buried there are mostly unknown: who they loved; whether they realized their dreams of wealth; how they spoke, swore, or sang. A straight history of their lives would limit their stories to the available verifiable facts. In the end, however, historical accuracy is the wrong standard to apply to a work like Deadwood. In taking creative liberties with the past, the show's creators intend no offense against history. All they ask is that the audience allow them -- in the words of Wild Bill Hickok -- to "go to hell the way I want to."