The Continental Op is called to Personville (known as "Poisonville" to the locals) by the newspaper publisher Donald Willsson, who is murdered before the Op has a chance to meet with him. The Op begins to investigate Willsson's murder and meets with Willsson's father, Elihu Willsson, a local industrialist who has found his control of the city threatened by several competing gangs. Elihu had originally invited those gangs into Personville to help him impose and then enforce the end of a labor dispute.
The Op extracts a promise and a signed letter from Elihu that pays the Continental Detective Agency, the Op's employer, $10,000 ($138,000 in 2016 dollars) in exchange for cleaning up the city and ridding it of the gangs. When the Op solves Donald's murder, Elihu tries to renege on the deal, but the Op will not allow him to do so.
In the meantime, the Op is spending time with Dinah Brand, a possible love interest of the late Donald Willsson and a moll for Max "Whisper" Thaler, a local gangster. Using information from Brand and Personville's crooked chief of police, Noonan, the Op manages to extract and spread incriminating information to all of the warring parties. When the Op reveals that a bank robbery was staged by the cops and one of the mobs to discredit another mob, a gang war erupts.
But the Op wakes up the next morning to find Brand stabbed to death with the ice pick the Op handled the previous evening. There are no visible signs of forced entry. The Op becomes a suspect sought by the police for Brand's murder, and one of his fellow operatives, Dick Foley, leaves Personville because he is uncertain of the Op's innocence.
The Op, now wanted by the police, entices Reno Starkey, a gang lieutenant, to take on the last strong rival mob, led by Pete the Finn. The last gangs are whittled down by pipe bombs, arson, gun fights, and corrupt cops gunning down the survivors.
The Op tracks down Starkey, the only gang leader still alive. Starkey is bleeding from four gunshot wounds, having just killed mobster Whisper Thaler. Starkey reveals that he was the one who stabbed Brand, and that she had collided with the semi-conscious Op so he looked like the culprit.
The corrupt police chief Noonan and the gang leaders are all dead. The Op blackmails Elihu Willsson into calling the governor, who sends in the National Guard, declares martial law, and suspends the entire police force. Elihu Willsson gets back his town, as promised—although not in the way that he had anticipated. The Op returns to San Francisco, where the Old Man (the chief of the Continental Detective Agency's office) gives him "merry hell" for his activities.