Anson Mount stars as a former Confederate soldier working on the railroad in "Hell on Wheels" (AMC).

“All of history is driven by the lion,” says transcontinental railroad investor Thomas “Doc” Durant (Colm Meaney) in the premiere of “Hell on Wheels” (Sundays 10 p.m./9 Central). “We drag the poor zebra kicking and screaming, staining the earth with his cheap blood. History doesn’t remember us fondly, but history is written by the zebra for the zebra.”

That’s a nutshell description of this new AMC series from Joe and Tony Gayton, a bloody western drama that has sharply divided critics. The major knock against it is that it’s no “Deadwood,” but what is? Set in the Nebraska territory circa 1865 and focused on the construction of the transcontinental railroad, “Hell on Wheels” is very much its own thing, and as coherent and on-message as any big-ticket TV drama I’ve seen. The first three episodes are vastly superior to the first three episodes of “Boardwalk Empire,” a similarly lavish period piece with a grim outlook on morality, commerce and human relations. And I was surprised by how quickly the series evolved before my eyes, shrugging off some unfortunate mannerisms as well as my own preconceptions about what it was going to be.

With its stony-faced but laughably well-groomed badasses, contemporary soundtrack and oddly tilted angles, the first 15 minutes of the pilot feel like a trashy modernist western with a cliched sense of what the genre is about — a silly graphic novel on film, maybe one or two steps up from Mario van Peebles’ horrid Old West beer commercial “Posse.” (Do you remember that movie? If so, my condolences on your lost two hours.) But by the end I was engrossed by the story, the setting and the large cast of characters, and somewhat amused by how quickly “Hell on Wheels” had veered away from self-conscious, rather shallow modernism and settled into a more classical groove.

The show’s main character, former Confederate soldier Cullen Bohannon (Anson Mount), mirrors the show’s evolution from forgettable curiosity to eccentric and promising drama. At the start of the pilot, Cullen seems like a cut-rate version of a numb Clint Eastwood gunslinger, and his character’s story — he’s hunting the men who murdered his wife — feels uncomfortably close to the plot of Eastwood’s 1976 classic “The Outlaw Josey Wales.” But Cullen proves less closed-off, and more complicated, than he initially seems.

When he warns a former slave turned railroad worker named Elam (rapper-actor Common) not to seek revenge against a white railroad overseer who murdered his friend, he tells him, “You have to be willing to let go of the past,” a statement that’s so at odds with what we already know about Cullen that at first it seems like a screenwriter’s mistake. But it’s really evidence of the show’s burgeoning complexity. Cullen and Elam are richer and more contradictory than they appear at first glance. The same proves true of the show’s other major players — even Colm Meaney’s character, Doc, who comes on like a scowling cardboard robber baron, but soon displays an ebullient fascination with history and myth. A long scene in the second episode in which Doc dictates an official account of Native American violence against white settlers — repeatedly increasing the number of attackers to amp up the victims’ martyrdom — fits into the modern western tradition of having characters write (and falsify) history right after it happens. But Meaney’s sprightly tone is something fresh. He reminds me of a self-aware Shakespeare villain who thinks of the world as a stage, and himself as a major player who’s always looking for opportunities to rewrite the drama to his advantage.

Much of the show’s action occurs in and around the title setting, Hell on Wheels, a camp that moves along with the construction of the continental railroad. It’s a muddy little burg in the tradition of David Milch’s Deadwood, the mining camp in “McCabe and Mrs. Miller,” and the oil field in Paul Thomas Anderson’s “There Will Be Blood,” which in some ways felt like a 20th century western in “Godfather” drag. What all these shows and movies have in common is a fascination with commerce and what it does to the individuals involved with it. “Hell on Wheels” is a perfect show for this grim era of American history, when any naively held illusions about the autonomy of the individual under capitalism have been ground into dust.

The ex-slaves who work on the railroad are in a sense still slaves, eking out a subsistence living under the gimlet eyes of overseers, some of whom have plantation experience. (One of them is Cullen, who gets a job on the railroad by telling a boss — a big-bearded Ted Levine, doing his best Walter Huston impersonation — that he’s handy with a whip.) The immigrants who work alongside the slaves — including a couple of young Irish brothers (Ben Esler and Philip Burke) who operate a tent containing a slide projector, a sort of protean version of cinema — are not much better off. They’re all cogs in the machine, fighting to carve out a place for themselves in a forbidding landscape that’s being bought, torn up and remade by forces they can barely comprehend. The Native American Joseph Black Moon (Eddie Spears) has found Jesus and bought a suit and a hat and now finds himself suspended between two cultures; his own tribe views him with suspicion, and his new identity as a Christian is unlikely to win him any favor with the white folks who are trying to dice up the prairie with rails.

The English immigrant Lily Bell (Dominque McElligott) comes to the territories via Chicago with her railroad surveyor husband, only to lose him to frontier violence almost instantly — trust me, this is not a spoiler; when’s the last time you were introduced to a frontier woman who didn’t end up single within a few screen minutes? — and finds herself alone on the prairie, forced to live off the land, a gingham-clad speck in a panorama of grass and flowers. (It’s only a matter of time before she and the show’s other widowed character find each other.) In next week’s episode, it becomes clear that the company that hired Lily’s husband couldn’t give less of a damn about her; dead or alive, she’s mainly useful as a symbol of imperiled Caucasian virtue — a means of prompting the federal government to send troops into the territories to exterminate all the brutes.

“Hell on Wheels” can be deeply irritating. It’s too ostentatiously aware of itself as a western, and a revisionist western at that. (Maybe the phrase “revisionist western” is meaningless and should be retired; can you remember the last time you saw a “traditional” western without a trace of nastiness, irony or cynicism?) There’s too much Machiavellian speechifying, and too many moments where the characters offer quotable words of wisdom to each other, and somebody needs to tell the makeup and wardrobe department to stop worrying about making everyone look handsome or beautiful; the performers shouldn’t have such modern-looking haircuts; the actresses shouldn’t be wearing modern-looking lipstick; the men’s beards should be scragglier; the clothes should be dirtier and more ragged, not off-the-rack pristine and pressed. And I’d like to see more attention paid to the details of building a railroad; there’s tremendous, mostly unexplored potential for drama in the mundane details of moving steel and rivets from point A to point B and making sure that the workers get fed and local officials bribed.

But these missteps are eclipsed by the show’s mythic feeling — more dreamlike than real — and by its characters, who keep revealing new sides. The great Tom Noonan is perfectly cast as a preacher who might be more or less worldly than you think (because Noonan plays sweetness and perversion equally well, he always surprises you); he gets a couple of nice moments in the pilot and many more in future episodes. The show’s best character doesn’t appear until next week: “The Swede,” the camp’s sheriff, who’s actually Norwegian. The actor who plays him, Christopher Heyerdahl, is an instant star. He looks a bit like Roy Scheider but philosophizes as casually as one of Ingmar Bergman’s spiritual pilgrims. He’s menacingly sure of himself, but there’s something sweet and damaged about him.

“Very moving images of home, boys,” the Swede tells the brothers, after watching slides of their home country projected on the tent wall.

“You don’t sound Irish,” one of the brothers says.

__________________In this world of sin and sorrow there is always something to be thankful for; as for me, I rejoice that I am not a Republican.
- H. L. Mencken