House Speaker John Boehner (R-Ohio) said he wants lawmakers to address the issue of the Confederate flag in a bipartisan manner. (Speaker.gov)

The Confederates launched a surprise attack, under cover of darkness.

It was 8:30 Wednesday night, and the House was plodding toward its 20th hour of debate on a little-watched appropriations bill, when Rep. Ken Calvert (Calif.), who had been leading the Republican side of the debate, rose. “I have an amendment at the desk,” he said.

Yes he did: A proposal to protect the sale and display of the Confederate battle flag at national parks and cemeteries.

Democrats couldn’t believe what they were hearing: Just as South Carolina legislators were finally voting to remove the symbol of hatred from their statehouse grounds, Republicans in the U.S. Capitol were proposing to restore the flag. And they were scheduling the vote for July 9, the anniversary of the ratification of the 14th Amendment promising equal protection of the laws.

The maneuver provoked a fusillade of outraged speeches on the House floor, culminating in an emotional plea Thursday afternoon by Rep. John Lewis (D-Ga.), the civil rights icon. “When I was marching across that bridge in Selma in 1965, I saw some of the law officers, sheriff deputies wearing on their helmet the Confederate flag,” he said. “I don’t want to go back, and as a country we cannot go back. . . . We all live in the same house, the American house.”

In the Speaker’s Lobby off the House floor, Rep. Lynn A. Westmoreland (R-Ga.) offered a rebuttal to that noble speech. He told reporters, including Jonathan Weisman of the New York Times, that the Confederate battle flag isn’t racist and that he didn’t think Confederate soldiers had “any thoughts about slavery.”

Asked if he could understand Lewis’s point, Westmoreland replied, “the question is, ‘Does he understand where I’m coming from?’ ”

We do — all too clearly.

Republican leaders, trying to end the humiliation they brought on themselves, pulled the appropriations bill from the floor. But how could such a fiasco occur in the first place? It’s not as if there’s a huge groundswell within Republican ranks to fly the Confederate flag — particularly after its association with the alleged killer in last month’s South Carolina black-church massacre.

Rather, Thursday’s Confederate flag debacle is a direct consequence of House Speaker John Boehner’s leadership strategy. Calculating that compromise with the Democratic minority will cause his conservative caucus to oust him from the speakership, Boehner has essentially chosen to pass a legislative agenda with only Republican votes. Because this leaves him a thin margin for error, it empowers the most extreme conservatives in the House, who have an incentive to withhold their votes if they don’t get everything they want.

This leadership style also bestows outsize power on conservative groups such as Heritage Action, an outgrowth of the Heritage Foundation. The group gets much credit for the 2013 government shutdown, and it has been influential in keeping the Export-Import Bank from being reauthorized and in getting a committee named to probe the Benghazi, Libya, attacks. Heritage Action also had much to do with the initial defeat of trade legislation last month — and it celebrated as Boehner abandoned his attempt to punish lawmakers who voted against it.

On the education bill, Heritage demanded that the legislation effectively take the federal government out of education policy by creating no-strings-attached block grants to states. When the bill came up in February without such a provision, conservatives balked, and Boehner’s team had to retreat. This time, leaders bought conservative votes by making such an amendment in order. The amendment failed, but the concession earned just enough conservative votes for the bill to pass by a bare 218-to-213 after extensive arm-twisting.

The flag fiasco followed a similar ideological dynamic. Republican leaders were coming up short on votes for the legislation, in part because some Southern conservatives were angry that the bill included language, adopted by the House in a voice vote, blocking the sale and display of the flag at parks and cemeteries. So the GOP leadership agreed to let these holdouts have a vote to reinstate the Confederate flag.

The result was embarrassment for a party that already has trouble with non-white America. Typical of the series of outraged speakers was Rep. Hakeem Jeffries (D-N.Y.), who displayed the flag in the well of the House. “Had this Confederate battle flag prevailed in war 150 years ago,” he said. “I would be here as a slave.”

Boehner seemed not to know what to do about the mess his lowest-common-denominator leadership caused. He told reporters he had “some ideas” about a conversation on the subject, “and when I firm them up in my head, I’ll let you know.”

Here’s one idea: Show some leadership.

Twitter: @Milbank

Read more from Dana Milbank’s archive, follow him on Twitter or subscribe to his updates on Facebook.