In May 1868, Hiram Whitley arrived in Columbus, Ga., to bring down the Ku Klux Klan. An undercover detective who worked for agencies of the federal government, Whitley came to Georgia at the behest of the U.S. Army, which was trying to protect African Americans’ voting rights in the South after the Civil War. For the past month, the Army had failed to prosecute the Klansmen who had murdered George Ashburn, a prominent Republican official who supported Reconstruction legislation.

Whitley adopted new tactics. Abandoning due process, he had soldiers drag suspects and witnesses to an isolated fort, where he extracted confessions with both cruelty and charm. He soon produced 12 murder charges, including one against a conspiring Union Army soldier.

Freedom’s Detective” by Charles Lane revolves around the fascinating figure of Whitley, whom President Ulysses Grant soon appointed to head the Secret Service, a federal agency created in 1865 to squelch counterfeit currency. Under Whitley, the agency also infiltrated and impaired the violent, politically motivated Klan. His story sharpens a paradox of the Reconstruction era. Whitley flouted ethics, curried partisan favor and violated civil liberties. At the same time, he promoted a more genuine American democracy.

Whitley was no idealist about racial equality — far from it. Before the Civil War, he posed as an antislavery zealot in Kansas, only to trick freedom-seeking slaves and collect bounties under the Fugitive Slave Act. During the war, he commanded a Union infantry unit composed of free black and mixed-race soldiers from New Orleans; his brutal methods almost triggered a mutiny, and the unit disbanded. After the war, during his 1868 investigation of the KKK in Georgia, he suspected a black man of withholding information about the Klan conspirators. Whitley blindfolded him and placed him in front of an artillery cannon. Upon pulling off the blindfold, he demanded details from the man, threatening him with execution.

A charismatic man with a goatee and intense blue eyes, Whitley reveled in skulduggery. As Secret Service chief, he employed small-time crooks to topple counterfeiting rings, reasoning that only underworld types could permeate these cabals. His style bore results: In 1871, he arrested Joshua Miner, the kingpin of a massive counterfeiting operation in New York City. Miner was also an esteemed Manhattan businessman with connections to Tammany Hall, the political machine of the Democratic Party.

Yet Whitley’s tactics provided ammunition for his targets. Miner escaped prosecution after his lawyers raised doubts about the sketchy former criminals who informed for the Secret Service. Similarly, lawyers for the Columbus Klansmen played up the torture of prisoners under Whitley, and those men ultimately walked free.

Whitley rose to influence under the rule of Republicans, who controlled the White House and Congress. They were building the infrastructure of a federal government that included the Secret Service. They were also enacting reforms, such as the 14th Amendment, that enshrined civil rights for a new constituency of freedmen and their allies. The Democrats, by contrast, were the party of the urban machines and white Southerners — those most threatened by Whitley’s crusades against corruption and political violence.

In 1870 Whitley’s outfit came under the new Department of Justice, and Attorney General Amos Akerman secured Grant’s approval for a Secret Service team to infiltrate the Ku Klux Klan.

“In all of American history,” writes Lane, “there had never been a federal undercover operation to investigate civilians for alleged criminal violations of the constitutional rights of fellow citizens, much less whites’ violations of African American rights.” Whitley would serve as “spymaster, organizer, and supervisor of what amounted to a domestic anti-terrorism unit within the Secret Service.”

Lane, an editorial board member of The Washington Post, tells dramatic stories of clandestine missions as the Secret Service moved into the South. In Moore County, N.C., the Klan prepared to lynch a white cotton trader who had supported the Union and joined the Republicans. But a federal agent had infiltrated that den. Before the noose tightened, federal troops swarmed in to make arrests. The Klansmen couldn’t shoot their way out, because the agent had replaced their gunpowder with sand. The agent then dressed five soldiers in Klan robes and paraded them, handcuffed, through downtown Raleigh, a cheeky demonstration of federal power over secret mobs.

By the early 1870s, the Klan was on the wane, but Democratic politicians were grousing that the Secret Service violated the rights of those under its surveillance. Congress started scrutinizing its budget and curtailing its role. In the final years of Reconstruction, terrorist groups again surged throughout the South, and as the federal presence faded in the late 19th century, white supremacy reigned. (Not until 1901, after the assassination of William McKinley, did Secret Service agents serve as bodyguards for the president.)

Whitley shaped both the Secret Service’s success and its decline. Despite his vigorous defense of black political rights, he trampled on ethical boundaries to court goodwill with Republican leaders. His agents gathered intelligence on political enemies of the Grant administration before the 1872 elections. They drugged the criminal, politically embarrassing stepson of a Cabinet official and then dumped him in Mexico City. Most damning, Whitley hatched a convoluted fake burglary attempt to discredit a Democratic critic named Columbus Alexander. When that scheme fell apart, Whitley was exposed. He had to resign in 1874. He spent his life’s last, long act as the owner of an opera house in Emporia, Kan.

Bolstered by deep research into government documents and press accounts, “Freedom’s Detective” paints an illuminating portrait of Whitley, an intriguing representative of Reconstruction’s feats and fiascos. It does not, however, always cohere as a work of narrative history. Lane jumps back and forth in time while his protagonist is battling counterfeiters and Klansmen, and it can be difficult to keep Whitley’s life in order. In the chapters on the Secret Service campaigns against the Klan, Whitley becomes less of a presence as his agents move into the thick of the action.

Moreover, although Lane deftly positions Whitley within American politics after the Civil War, the main figures are all white — even in the chapters on racially motivated violence. Lane is sensitive to the struggles of African Americans, but he could have fleshed out the perspectives of more black characters, which would have illustrated the true resonance of the Ku Klux Klan. Strangely, for a book stuffed with tales of racist brutality, “Freedom’s Detective” might underplay the terror that animated the Reconstruction South.

Freedom's Detective

The Secret Service, the Ku Klux Klan and the Man Who Masterminded America's First War on Terror

By Charles Lane

Hanover Square. 348 pp. $26.99