There was a time when it wasn't safe to walk the cobblestone streets of Deadwood. But that was a thousand gunfights and bar-room brawls ago, when the settlement established illegally in the Black Hills of South Dakota was known as the wildest, wickedest and woolliest town in the West, a place so filled with mud, blood, beer and sultry upstairs girls that it spawned its own television series.
This is the town that witnessed Wild Bill Hickok gunned down while playing poker with his back to the door. These are the same streets that felt the footprints of Calamity Jane Canary, a one-woman cyclone who claimed she could out-drink, out-swear and out-spit any man.
Fortunately, before the turn of the century much of the city's wealth found its way into the pockets of merchants, bankers and saloon-keepers who cleverly invested it in beautiful Victorian buildings and residences that today stand as testament to a richer, yet rougher time.
New Zealanders wanting to see where the television series originated will find a beautiful, gracious, law-abiding town, where tourism, rather than the six-shooter, reigns supreme.
Deadwood has been designated a National Historic Landmark - one of just a handful of American towns to earn that recognition - and it attracts more than a million visitors a year.
But, be warned, you may still find your progress blocked by a traffic sign proclaiming, "Whoa pardner, gunfight!" And you may still see moustachioed, guntoting hombres in buckskins swaggering ominously down the boardwalks outside the wooden facades of hotels and emporiums that recall how the town looked in its earliest days.
After all, before it was civilised, Deadwood was anything but a haven for the well-heeled, the well-mannered and the righteous.
The town had its beginnings in 1874 when the fabled General George Armstrong Custer led 100 wagons and 1000 men into the Black Hills of Dakota Territory, hitherto, because of a treaty between the Lakota Sioux tribe and the US Federal Government, the last remaining uncharted region of the United States.
Ordered to map this emerald oasis, Custer's men also confirmed the presence of gold and the news sent a wave of miners, muleskinners and madams across the vast sea of prairie known as the Great Plains to the ancient mountain range of the Black Hills.
The US Army tried to honour its treaty with Native Americans, escorting would-be miners and settlers out of the Black Hills at gunpoint to military forts in nearby states. But the effort proved futile, as the cascade of gold-seekers continued.
In just a few months, Deadwood swelled from a few ramshackle huts to more than 7000 uninvited residents. By 1876, 10,000 fortune-hunters had set up permanent camp in Deadwood Gulch, where lawlessness and primitive conditions contributed to what some historians have described as a death a day.
Besides sporadic gunfights and misdirected gunfire, settlers in this new frontier had to be concerned with consumption, freezing, fever and pneumonia, the most common causes of death in the early years.
As the town grew, so did the official list of reasons for taking the proverbial dirt nap - adding gravel, worms, alcoholism, heart disease, sunstroke and teething, as well as getting struck by lightning, killed by Indians, kicked by a horse, murdered, gored, scalded, struck by a falling body, and "shot sparking another man's wife".
Amid the pine-clad cliffs of the fabled Black Hills, where claim disputes were settled with six-guns and life was cheap, it took time for civilisation to take root. But, without that adolescent period of recklessness, Deadwood wouldn't have been much of a story today.
That real-life web of intrigue, crime and carelessness is what HBO's Deadwood tries to replicate. Created and produced by David Milch (NYPD Blue, Hill Street Blues), Deadwood attracted several million more viewers an episode in its US debut year than did Sex and the City and The Sopranos.
Set in 1876, two weeks after Custer's Last Stand at the Little Big Horn, the hour-long drama tells the story of just and unjust men in the lawless town of Deadwood during one of America's last great gold rushes.
"This series could be thought of as The Sopranos with six-guns," says George Milos, director of the town's chamber of commerce.
"In its early years, Deadwood really was known as the wildest and woolliest town in the West, and HBO's depiction may actually be the West as it was."
The popularity of the dramatic series, now being shown New Zealand as well as Britain, Australia and Brazil, has only served to strengthen Deadwood's designation as a holiday destination. But that wasn't always the case.
In its early days the town's businesses, banks and homes were built of wood, and were frequently consumed by fires and floods.
Tired of the labour and expense of rebuilding time and again, successful merchants and bankers began building in native stone. More than 100 years later, those Victorian buildings with elaborate facades still stand in downtown Deadwood as testament to the wealth that lay beneath its soil.
From its rough and tumble beginnings as a frontier town, gold dust fuelled a transformation. That changed a hodgepodge of quickly constructed shacks and sheds to a civilised community featuring theatres, churches and Sunday afternoon socials.
The first telephone lines were installed in 1879, just three years after the first miners stumbled into the gulch and only a year after the first telephone had been installed in the White House. In 1883, electric lights began illuminating the homes, businesses and streets of Deadwood, long before such conveniences followed the plow across the prairie to the average farming community.
For the next 100 years, Deadwood followed a familiar pattern of highs and lows, which generally echoed the nation's economy, and specifically, the price of gold. But in the 1980s, with corporate mining downsizing its operations, Deadwood was all but dead.
In the late 1980s, Deadwood was labelled "a disaster" by historic preservation officials who were witnessing the slow deterioration of its once-proud past. Streets were decaying, building facades were crumbling and, except for the busy summer months when families flocked to the Black Hills and nearby Mount Rushmore National Memorial, employment opportunities were wanting.
After a century of boom-bust cycles, Deadwood was just a remnant of its glorious past, mayor Francis Toscana recalls. Vacant commercial buildings were sending a signal of despair as well as declining employment opportunities for the town's younger residents.
"What we had was a storied past filled with colourful characters who helped shape the West, vacant buildings with once-proud Victorian facades, and a future as bleak as a cloudy day," Toscana says.
"As a resident, it really was quite discouraging."
But instead of giving up, voters in 1989 approved limited stakes gaming to generate revenues that would then be dedicated to restoring and preserving this mile-high community. Sixteen years and US$170 million ($230 million) later, state and national historic preservation officials call Deadwood's metamorphosis "a miracle".
Brick streets, period lighting and colourful trolleys greet visitors who spend hours ducking in doorways and trying their luck in the town's 80 gaming halls.
In addition, they take part in historic walking tours, visits to the town's own Boot Hill - where both Wild Bill and Calamity Jane are buried - and touring Deadwood's museums and historic homes. Today, the community, with just 1380 residents, is recognised as a historic treasure.
"We've had our struggles, our disagreements and differing philosophies, but one thing stands clear," says Joe Peterson, a member of the Deadwood City Commission.
"With gaming tax revenues, more has been done in a decade and a half in Deadwood than most towns could ever hope to accomplish in a half-century."
As you walk the streets of Deadwood today, you'll notice history around every corner and Victorian homes precariously perched on the steep hillsides of the legendary gulch. A city-wide, self-guided walking tour retraces an unforgettable era, pointing out key buildings, events, disasters and sites tied to the drama of Deadwood's past.
While the buildings have been restored to capture their original grandeur, even greater changes can be found in the attitudes of Deadwood residents and visitors, according to Mayor Toscana.
"Sixteen years ago Deadwood sent a signal to the rest of the world that we were not willing to let our town die, that we would not stand idly by while the ravages of time slowly whittled away at our most precious resources," Toscana says.
"We gave notice that Deadwood was determined to rebuild, renovate and preserve its treasured resources and in so doing, we made Deadwood the home the rest of us had really only dreamed of."
What he calls Deadwood's "little experiment" has led to more than $170 million in a major community facelift and created more than 2500 new jobs - mostly employing people from surrounding towns - by attracting a growing number of tourists.
Local businessman Dennis Anderson agrees with Toscana's assessment, adding that HBO's series reflects the origins of the community, and has helped millions of television viewers around the world focus on Deadwood.
"The benefit of hindsight allows us to know now that Deadwood did it right," Anderson said.
"This community was founded on gold, guts and the spirit of the American West. This is Deadwood, the town that saved itself."
Deadwood is nestled in the narrow gulches of the northern Black Hills, which are found in extreme western South Dakota near the centre of North America.
Getting there: Three major airlines (Northwest/KLM, United and Delta) serve Rapid City Regional Airport, the gateway to the Black Hills, via Salt Lake City, Denver or Minneapolis/St Paul.
Accommodation: For all-inclusive travel packages (airfare, rental cars and accommodation), call Black Hills Central Reservations on 001 866 329 7566.
• Deadwood resident Tom Griffith is a member of the Western Writers of America and the author of numerous books, including America's Shrine of Democracy, South Dakota and A Winning Tradition, as well as dozens of magazine and newspaper articles.