Editor's note: David Frum writes a weekly column for CNN.com. A resident fellow at the American Enterprise Institute, he was special assistant to President George W. Bush in 2001-2. He is the author of six books, including "Comeback: Conservatism That Can Win Again" and the editor of FrumForum.

Washington (CNN) -- It took the United States government 18 months to capture Khalid Sheikh Mohammed -- and seven years to figure out what to do with him.

The Bush administration wanted to try the organizer of the September 11, 2001, terrorist attacks before a military tribunal in Guantanamo Bay. The Obama administration rejected that plan and decided instead on a civilian trial in federal court in lower Manhattan.

Whoops.

New York officials balked: The trial would snarl traffic, impose huge security costs on the city and incentivize terrorists to strike again while world media were conveniently concentrated on the spot.

The public balked too. Even in liberal Massachusetts, voters have rallied to the Republican anti-trial message. Scott Brown's campaign hammered the theme: "Our tax dollars should pay for weapons to stop terrorists, not lawyers to defend them."

The Obama administration is stuck in a mess of its own making. It has tried to trace a middle path between the clear logic of the civil liberties left and the Bush right.

The left says: Terrorists are criminals. Period. Read them their rights and give them a full constitutional trial. If you have secret information that cannot be used in open court -- too bad. If you cannot convict them, let them go.

The Bush administration answered: al Qaeda is a paramilitary force organized to commit atrocities against American civilians. They are not ordinary criminals. They are war criminals, just like the Japanese commanders who starved American servicemen on the Bataan death march. Those commanders faced military justice that protected fundamental human rights. But they were not brought to the United States and accorded all the extra protections of the U.S. Constitution.

The Obama administration has split the difference. It says it will assign terrorists on a case by case basis, sending some to civilian courts, others to military tribunals.

This seems to offer the worst of both worlds. From a civil liberties point of view, it is worse than the Bush policy. The Bush administration worked its way to a policy of military tribunals for non-citizen terrorists. You can dispute the principle, but you can at least understand it.

The Obama policy follows no such intelligible principle. Terrorists against whom the administration has a strong public case will go to federal civilian court; terrorists against whom the public case is less strong will go to military tribunals. What kind of way is that to run a judicial system?

And from the national security perspective of the right, the policy is equally bizarre. If you want to build a federal case against an accused terrorist, you have to follow federal criminal rules from the beginning: that's why the Obama justice department read a Miranda warning to the underwear bomber. But following federal criminal rules means closing our ears to valuable information. As soon as the underwear bomber got his Miranda warning, he stopped talking.

We send criminals to court because we want to punish them. But with terrorism, punishment is a secondary concern. Our top concern is prevention.

By failing to interrogate the underwear bomber exhaustively, the Obama administration failed to do all that is possible to protect the country. They closed their ears to potentially useful information. The underwear bomber may divulge more later. But information loses value by the day, sometimes by the hour. Later may be too late.

The mishandling of the underwear bomber was embedded in the decision to try Khalid Sheikh Mohammed in federal court. If the Obama administration had adhered to prior decisions on military tribunals, it would have left itself room to handle the underwear bomber more responsibly.

And yet this mishandling of the underwear bomber will buy them very little goodwill from their domestic and international left. The Obama administration will continue to hold some terrorists indefinitely without trial. It has left the door open for military tribunals for others. As a result, it will receive almost as much criticism as the Bush administration -- while taking many more risks with the lives of Americans.

President Obama's admirers often compare him to Ronald Reagan. Here's something he can learn from Reagan: how to liquidate an embarrassing policy commitment.

In the late 1970s, conservatives opposed Jimmy Carter's Panama Canal treaty as intensely as liberals denounced George W. Bush's detention policies. The treaty returned the Canal and the Canal Zone to Panama over a period of years. To conservatives, it symbolized American retreat post-Vietnam. Ronald Reagan's passionate opposition to the treaty helped him secure the Republican nomination in 1980.

Yet by the time Reagan gained the presidency, the treaty had become less bothersome. Reagan's election in itself signaled that the period of retreat was over. Beyond symbolism, the Reaganites recognized that the Canal had already lost much of its military utility: It was too narrow to accommodate modern aircraft carriers.

The treaty had gained the United States great goodwill in Panama -- helping to insulate Panama against the left-wing insurgencies that raged elsewhere in Central America. Quietly and deftly, Reagan tip-toed away from the issue.

It's time for Barack Obama to do the same with his most ill-considered pre-election commitments -- with counter-terrorism policy at the head of the list.

The opinions expressed in this commentary are solely those of David Frum.