Sam Hammett was a wayward youth. Having left school at the age of 13, he spent his teenage years holding down odd jobs, blowing his paychecks on horse races and boxing matches, and consorting with prostitutes in the rougher sections of Baltimore and Philadelphia. Within a few years, alcoholism had its claws in him, and by age 20 it was rumored that he had already contracted a venereal disease.

In 1915, Hammett, the son of a Maryland farmer, joined the Pinkerton National Detective Agency at the age of 21. During the early 1890s, the Pinkertons, as they were more commonly known, had boasted a force of 2,000 active operatives and some 30,000 reserve officers. By comparison, the United States Army, which for decades had been primarily concerned with fighting Native Americans in the West, had fewer than 30,000 officers and enlisted men assigned to active duty. To their enemies—usually the labor unions—the Pinkertons were a private militia at the beck and call of industrialists, bankers, and other agents of capitalism. The state of Ohio outlawed the Pinkertons for fear that they could form an army outside the purview of the American government.

For Hammett, the Pinkertons initially proved salutary. While working out of their Baltimore office, Hammett acclimated to being on call 24 hours a day and immersed himself in the highly organized indexing system that was the agency’s calling card. The Pinkertons were initially created by Allan Pinkerton, a Scottish immigrant with a natural talent for solving crimes, in order to bridge what he saw as the divide between Washington’s measly law enforcement arm and the various local police forces sprinkled throughout the nation. His agency created a highly detailed criminal database that included newspaper clippings, mugshots, and Bertillon measurements for individual suspects or culprits.

This system is more or less the precursor to everything from the record-keeping systems at Interpol to those at local police precincts. Before the creation of the Bureau of Investigation (the FBI’s direct ancestor), the Pinkertons were perhaps the only truly national law enforcement agency in the United States, and for a time, their services were employed by the White House.

With the agency’s success came controversy. During the pitched battles between laborers and business owners that marked the late 19th and early 20th centuries, the Pinkertons were on the side of owners, paid to take an active, violent role in breaking strikes. Painted as marauders by the striking steel workers at Homestead in 1892, the Pinkertons lost the support of a segment of the middle-class reading public when reports of their bloody engagements with the striking workers came to light.

In the July 7, 1892, edition of New York’s Evening World, they were called a “sorry lot” and an unforgiving army that had come to western Pennsylvania to establish civil order at any cost. Similarly, the Winchester-toting private detectives were labeled “dogs of war” and “hired thugs” by The St. Paul Daily Globe. Over 100 years later, the blog Daily Kos, echoing the language of the 19th-century labor unions and their supporters, labeled the Pinkertons “the Blackwater of the late 19th and early 20th century.”

In a twist of irony, the highly unpopular union-busting activities of the Pinkertons frequently pitted working-class and lower-middle-class detectives against poorly paid laborers. According to Beau Riffenburgh’s Pinkerton’s Great Detective: The Amazing Life and Times of James McParland, the average salary for a Pinkerton operative in the late 1800s was about $12 a week, which looked good in comparison to the 15 or 16 cents per hour that unskilled laborers made in industrial cities such as Detroit and Pittsburgh. In the ranks of both labor and private law enforcement, recently arrived European immigrants were well represented.

By his own admission, Sam Hammett left the Pinkertons because of their hard-line stance against the unions. On a darker note, Hammett, while working in Montana on behalf of the Anaconda Copper Company, was offered $5,000 to murder Frank Little, an organizer for the radical Industrial Workers of the World. Hammett declined, and due to his later reputation for embellishing, it’s hard to say with certainty whether or not this apocryphal tale is even true.

What is true, though, is that some people wanted Little dead, and on August 1, 1917, not long before Hammett volunteered for the U.S. Army and by a series of unfortunate events contracted the tuberculosis that would ultimately kill his P.I. career, five or six masked men entered Little’s residence, abducted him, and then hanged him from a railroad trestle.

After leaving the Pinkertons in 1922, Sam Hammett took to calling himself by his mother’s maiden name, and, as Dashiell Hammett, became a frequent contributor to the pulpy fiction magazine Black Mask. With those stories, he began to popularize the “hardboiled” style of American detective fiction. Although his most famous creation remains Sam Spade—the amoral private detective central to the action in The Maltese Falcon—Hammett’s first P.I. hero was the short, fat gumshoe known simply as “the Continental Op.”

Drawing on his experience in the Pinkertons, Hammett imbued his Continental Op tales with a type of gritty realism and working-class cynicism that stood in contrast to the prevailing structure at the time, which relied on the archetype of the gifted amateur. And unlike the cerebral Sherlock Holmes or the foppish Hercule Poirot, the Continental Op reads like a believable person, if only a little too tough for his own good.

When Hammett started writing his Continental Op tales in the early 1920s, the private-detective industry was in a transitional period. Along with the more-muscular federal agencies such as the Bureau of Investigation and the Secret Service, municipal departments in New York, San Francisco, and other American cities had undergone sweeping changes two decades before. Now larger, better equipped, and better educated thanks to civil-service reforms, professional lawmen began rendering large private detective agencies obsolete.

At the same time, private detectives were becoming affordable to the increasingly prosperous American middle class of the Jazz Age. Marital complaints, will disputes, and the protection of banks formed the meat and potatoes of private-eye work during the dramatic golden years of their fictional counterparts.

But the private eyes of the 1920s had less in common with their more-militarized, strike-busting forefathers than they did with the original P.I.’s of the early 19th century (or with their successors today, for that matter). Ever since the establishment of what is typically considered the first private detective agency in Paris in 1833, investigators had served clients who felt that the police were either unwilling or unable to do the work they required. The first private-eye celebrity, the former criminal-turned-police investigator Eugène François Vidocq, had opened his Bureau des Renseignements, or "Office of Information," after being pushed out of his public job during an internal overhaul that sought to clear out ex-cons.

Vidocq’s Office of Information quickly set about representing the interests of businesspeople and private citizens using the most advanced methods of early criminology and even rudimentary forensics. Its success incurred the wrath and distrust of the Parisian police, who hounded Vidocq with numerous arrests until the financial stress of repeatedly having to clear his name forced him to consider selling the agency in the 1840s.

Vidocq always cited his personal knowledge of the underworld as the reason for his success, and because of that hired many former criminals to act as his bloodhounds. His morally questionable employees would set a stereotype of private investigators that would last for decades; by the time the Pinkertons were terrorizing the workers at the turn of the century, the public was used to thinking of private investigators as threatening and untrustworthy.

As Hammett continued writing, the industry he wrote about grew more and more mundane. When the Pinkerton National Detective Agency, now simply called Pinkerton, was purchased by the Swedish security company Securitas AB in 1999, the romantic tradition of the American private eye had officially come to its end. It had been a love affair long in decline, as the mid-20th century’s police procedurals and dashing G-men effectively squeezed out private investigators from both the workforce and the written word.

Private-detective novels set in the modern day are rarely published anymore, and most private investigators now either work as lone-wolf operators handling the type of cases that the Pinkertons explicitly shunned (divorce cases or overly salacious scandals that could ruin reputations, for example) or sit behind a desk, a computer monitor their primary tool. Technology made it obsolete to shadow suspects on foot (Hammett’s specialty) and by car, with satellite imagery making it possible to see a case to completion from the privacy of a cubicle.

The private-investigation industry has moved on to the worlds of white-collar crime, corporate espionage, and surveillance. The most recent Department of Labor statistics (from 2012) depict a group of workers firmly within the middle class—median pay is a little over $45,000 a year. With only a modest increase in the number of American private investigators predicted by 2022 (from 30,000 to 33,300), it’s fair to say that today’s private eyes don’t pose the same threat as the Victorian-era Pinkertons—and that tomorrow’s Dashiell Hammett will be today’s tech geek, not yesterday’s whiskey-drinking roughneck.