Samuel Dashiel Hammett was born on a farm in Maryland in 1896. He left school when he was 13 years old and held several jobs before working for the Pinkerton National Detective Agency. He was an operative for the Pinkertons from 1915 to February 1922, with time off to serve in World War I. When his first marriage failed, Hammett turned to alcohol before working in advertising and, eventually, writing. His work at the detective agency provided him the inspiration for his writings. Hammett wrote most of his detective fiction during the 1920s when he was living in San Francisco. In 1931 Hammett embarked on a 30-year affair with playwright Lillian Hellman. He wrote his final novel The Thin Man in 1934. Despite it being his most successful work to date, he gave up writing and devoted much of the rest of his life to left-wing activism. He was black-listed as a Communist in the 1950s and he gradually withdrew from public life, the effects of tobacco and alcohol having a detrimental effect on his health. He died of lung cancer in 1961.