Anything goes in ‘Deadwood’s’ gritty, lawless Western world

? Deadwood is a realm of furious desires and a notable lack of restraint.

It’s a mining camp which, in July 1876, occupies Indian territory in what someday will be South Dakota, and it beckons with gold as well as unaccountability: You can’t break laws in a place where laws don’t exist, nor must you answer for laws you broke elsewhere.

This is the setting for HBO’s “Deadwood,” a spellbinding 12-episode series that premieres at 9 p.m. today. It stars, among others, Timothy Olyphant, John Hawkes, Ian McShane, Molly Parker, Brad Dourif, William Sanderson, Robin Weigert as Calamity Jane, and Keith Carradine as the legendary gunslinger “Wild Bill” Hickok.

“Deadwood” is a Western, of sorts. But don’t expect big skies or buffalo thundering across the plain. A certain respect for the land is standard in most Westerns, but fortune hunters flocking to Deadwood regard the land as something to be pillaged. There’s no room for myths here. In Deadwood, even nature has been shrunk to a fractious human scale.

“Deadwood” was created by David Milch, who also serves as its executive producer and head writer.

Milch, a potent blend of Yale erudition and tough-guy grittiness, is best known as the driving force of “NYPD Blue,” to which he brought realism and tersely poetic dialogue.

So how did Milch get from Manhattan’s rough 15th Precinct to Deadwood’s muddy mean street?

“The series that I had worked on previously,” he explains, “had to do with those who administered the law but who were outside the law: Every cop knows that if you’re going to be effective as a cop you must break the law.”

Conversely, in “Deadwood” Milch saw a chance to explore how humans maintain order when there are no cops around nor laws on the books.

One way, he suggests, is the civilizing effect of free enterprise.

In Deadwood, a business district is springing up to receive the dreamers and vagabonds. There’s a local newspaper, a hotel, a full-time doctor. There’s a saloon and brothel called the Gem, owned by the chillingly charismatic mogul Al Swearengen (McShane).

Olyphant and Hawkes play partnered-up entrepreneurs who come to Deadwood to open a hardware store, for which they lease a prime lot from Swearengen on Deadwood’s main drag.

But if these amenities speak to Deadwood’s softer side, make no mistake — around these parts, it never gets too soft. This is a heartless place even after death, when a corpse just might get heaved in a pen for the wild hogs to feast on, sparing anyone the bother of digging a grave.

So why do people come here? Can wanderlust or a bald desire for self-enrichment fully account for it?

“Who the (heck) leaves home,” Milch poses, “and goes into the wilderness, where the Indians have just murdered Custer” — at nearby Little Big Horn a scant two weeks before the series starts — “and then lives where there’s constant danger and the streets are knee-deep in (crap)? Who does that?”

His answer: “Someone who NEEDS to! The guy who settles the frontier is the risk-taker, and he was, even before leaving home. He’s the guy who felt at risk already” — a mix of alienation and what Milch calls hypervigilance — “and he’s seeking some objective accommodation in the physical environment for his own internal chemistry.”

He’s seeking a physical environment like Deadwood, where anything goes.

And especially in the language, which is as strong as the hooch swilled at the Gem. The premiere is barely 2 minutes old before the F-word is first heard — after which you quickly lose count.

Not only is it dramatically justified, but, Milch insists, historically on target. According to contemporary accounts, “the profanity was an overwhelming, almost terrifying characteristic of the camps,” he says. “Those who went to the camps, specifically a criminal element, were a group accustomed to using language as a way of separating themselves from polite society.”

Fortunately, Milch, the literary stylist, knows how to turn cuss words into grace notes.

That means you’ll hear full strength this scorching yet sublime self-appraisal from Swearengen: “I’m a simple-type (expletive), one who sees lightning and readies for thunder, and takes the thunder, if it comes, as a part of the same (expletive) storm.”

Swearengen is the demon supreme of “Deadwood.” As for Hickok, he reigns as the towering hero.

Hickok is also a heedless drunk and gambler who knows he, like the rest, is living on borrowed time. But as a risktaker, he wouldn’t think of living any different. That would break the only law Deadwood’s got.