But the core of Mr. Witt’s book, a result of five years of far-flung archival research, is his account of the Civil War, which gave rise to the first modern code of wartime conduct, commissioned by Lincoln on the eve of Emancipation, just as he was preparing to intensify the war.

The code was written by Francis Lieber, a German-born legal scholar and man of contradictions. He had sons on both sides of the Civil War. He was a lifelong critic of slavery who once owned slaves. He was a devotee of the German theorist Clausewitz (“War is the continuation of politics by other means”) who proclaimed the purifying virtues of war even as he set to writing the first formal code constraining its savagery.

Or constraining it somewhat. Lieber’s code, authorized by Lincoln in April 1863, banned torture and the use of poison gases, and set out a distinction between combatants and civilians that remains enshrined in the Geneva Conventions of 1949. But beyond that, the code included few hard-and-fast rules that could not be overturned by what it called “military necessity.” The code, Mr. Witt writes, was both “a humanitarian shield” and a “sword of justice,” forged in service of Lincoln’s crusade to end slavery forever.

Lieber was something of an intellectual celebrity in his time. His 1861 lecture course on laws of war at Columbia’s newly founded law school was published in full in The New York Times. But he has been little known in Civil War history, Mr. Witt notes, ignored by scholars who have tended to view the legal rules of war as irrelevant to events on the ground.

The international lawyers who see Lieber as a founding hero, however, also fail to see him clearly, Mr. Witt argues. Lieber’s code may have unequivocally banned torture, but it was far from the rigorously neutral set of rules that is enshrined in humanitarian law today.

“The effort of the contemporary laws of war is to avoid taking sides,” Mr. Witt said. But Lieber’s code was “developed by a side for the purpose of helping it win a war.”

Mr. Witt is a Quaker school alumnus (and son of a conscientious objector) who describes his views on war as somewhere “in the muddy middle, along with Lincoln and Obama.” He has largely stayed neutral in the post-Sept. 11 legal wrangling over torture, detentions, drone strikes and other tactics in the war on terror.