During the American Civil War irregular militias and guerrilla bands were operating on both sides. They often made no distinction between unarmed civilians and the opposing armed forces. One of the most notorious examples was the attack on the town of Lawrence in Kansas in August 1863 by the Confederate Quantrill Raiders. They destroyed part of the town and killed 150 civilians. In the same year President Lincoln signed an edict that the Union forces would abide by the Lieber Code (named after the legal expert who drew it up). This stated that if the population did not resist military authority, it should be treated well. The code did not apply if civilians took up arms or actively supported guerrilla bands.
Although the Lieber Code only applied to the conduct of US forces it was used as the basis for the Geneva Convention of 1907.