To combat the KKK and other groups, the North placed the South under martial law. They pushed through legislation while the Southern states had no representation in Congress permanently freeing the slaves and giving them voting rights. Then an occupation force was sent to enforce it, since this was pretty much unpopular with everyone, not just the Klan. Martial law would be lifted and then reinforced several times.
There are no documented attacks against the occupation force of Union soldiers by the Klan or other similar groups, so there wasn't too much strong enforcement against them specifically during Reconstruction by the Union. Thousands of deaths are documented as attributable to racial violence during this era. Much is mob violence, suggesting that the tension was deeper than attributable to one organization.
The Rise of Klu Klux Klan
In the 1868 presidential election, Republican Ulysses S. Grant won the office with the slogan, "Let Us Have Peace." Republicans also won a majority in Congress. Many Northerners, disgusted by Klan violence, lent their support to the Fifteenth Amendment, which gave the vote to black men in every state, and the First Reconstruction Act of 1867, which placed harsher restrictions on the South and closely regulated the formation of their new governments.
Other legislation attacked the Klan more directly. Between 1870 and 1871, Congress passed the Enforcement Acts, which made it a crime to interfere with registration, voting, officeholding, or jury service of blacks. More than 5,000 people were indicted under these laws; a little more than 1,000 were convicted.
In 1871 Congress also passed the Ku Klux Klan Act, which allowed the government to act against terrorist organizations. Grant did not rigorously enforce these laws, although he did order the arrest of hundreds of Klan members. But with the overwhelming support of the Klan in the South, convictions proved difficult to obtain, and the financial panic of 1873 would distract the North from the problems of Southern racism. In 1882 the United States Supreme Court declared Ku Klux Klan Act unconstitutional.
The North combated these problems in a few ways:
First, they disenfranchised everyone who fought for the Confederacy and disallowed them from holding any political office, such as police chief. Later a "loyalty oath" was introduced, but most refused to take it. Politics at this time was a very closed profession. Old families held political positions for generations. This made the Klan lack official political power, which was true before martial law. Freed blacks became a much more powerful political force when all the former politicians could no longer hold office and many learned about politics during this time period. The Freedmens Bureaus provided help in voting to freed slaves.
Second, elected judges were removed and replaced with military tribunals. Klansmen who killed someone trying to vote or run for office would not evade justice because their actions were popular.
Most "law enforcement" against them was done in most states by black militias with the support of Republican governments, which could be strong or weak support. Republican governments in Tennessee, Arkansas, Texas and North Carolina were the most effective, although none were highly effective.
North Carolina governor, Holden, was the first to attempt to combat the Klan after the murder of a black man, "Chicken" Stephens. This sparked the event known as the "Kirk-Holden War." Martial law was declared in the countries where the klan was most active and the state militia was used to suppress the violence. Over 100 arrests were made, but as the actions were unpopular and lacking federal support, all of the suspects were released.
In Tennessee where the Klan originated, the state militia was called out to suppress the Klan. The members went into hiding and no arrests were made, but the violence stopped temporarily.
Texas governor, Edmund Davis, conducted the most successful effort to end Klan violence. His militias made over a 1000 were indicted and this put down the Klan and paramilitary groups for a number of years. Some were given fines and 65 were given federal prison sentences. In the end though, the Klan put down Governor Davis.
Re-elected in 1873, the paramilitary group, the Travis Rifles, opposed his election. He barricaded himself inside the state house protected by the black militia, but without federal support gave in to their demands and resigned.
In other states, especially Mississippi, Louisiana, Alabama and South Carolina, the power of white supremacy paramilitary forces was much stronger. Although state militias were sometimes called out, they were also sometimes completely routed and beaten militarily. Most governors feared using a state militia composed almost entirely of black troops in case it would cause a race war. Fearing a military defeat and race war, the governor of South Carolina decided not to even attempt to fight the Red Shirts, the active group in the state.
Instead, in South Carolina, using the Third Force Act, the Union army cracked down on the Klan in the up country and one trial was held in Columbia after a few hundred were indicted (formally charged with a crime), while two thousand are believed to have fled the state. There were only a few convictions. The trial did tamp down on much of the worse violence, though.
Using U.S. Marshalls and the US Army, the Department of Justice under the direction of Amos T. Akerman managed to secure 600 conviction throughout the South in 1871.
With the assistance of Sol. Gen. Benjamin Bristow there were 3000 indictments of Klansmen throughout the South, and there were 600 convictions. Sixty-five percent of the Klansmen convicted were put in federal prison for five years. The result of Akerman and Bristows prosecutions and President Grant's willingness to enforce the law to stop the Klan, led to massive African American voting turnouts in 1872.
Akerman was asked by Grant to resign in 1871 and federal enforcement again became very weak.
After the Colfax massacre in Louisiana, the federal government brought a civil rights case against nine men (out of 97 indicted) who were accused of paramilitary activity intended to stop Black people from voting. In United States v. Cruikshank (1876), the Court ruled that the federal government did not have the authority to prosecute the men because the Fourteenth and Fifteenth Amendments provide only for redress against state actors.
The Reconstruction Era is usually dated as ending in 1877.