We seem to have spent our way into allowing our friends the Pakistanis to enter into a peace treaty, or something that looks like it, with the Taliban.

The United States has spent $864 billion pursuing security, or justice or vengeance — take your pick — in the years since the terrorist attacks of Sept. 11, 2001, according to the Congressional Research Service. That does not include the billions spent on homeland security. It does not include anything for the Obama administration to spend on a long-term program to bolster the fragile stability in Iraq or, more urgently, to counter the disintegration of it in Afghanistan and neighboring Pakistan.

That is nearly $100 billion more than the economic stimulus package President Obama signed into law on Tuesday. Republicans, who expressed sudden and sanctimonious revulsion against spending at home, had no such pangs when they voted, blithely and often blindly, to spend without restraint on foreign policy and military fiascos abroad.

The point of it all, at the outset anyway, was to uproot the Taliban and al-Qaida from Afghanistan, where the devastating attacks were plotted, and promote a more just and presumably more stable civil society. But like novices placing all of our bets on the day’s hottest stock, we now have been rewarded with the cruelest outcome on our investment.

Pakistan has, in essence, ceded rule of pivotal tribal areas near the Afghan border to an entrenched radical insurgency. It has officially agreed to allow the imposition of an extreme form of Islamic law that, among other things, bans education for girls and condones brutal forms of retribution. In recent months, insurgents in the region have assassinated secular political opponents, conducted beheadings and shuttered — and bombed — schools for girls.

If all this sounds eerily reminiscent of Taliban rule in Afghanistan before the U.S. and NATO military action to remove it, that’s because it is. Having failed miserably — despite receiving billions in American military aid — to quash the militants in the border areas, the Pakistani government has now, at least temporarily, given up and provided them with a safe haven, as well as a “legal” system of their own.

Anyone hoping that Obama’s decision to dispatch an additional 17,000 American troops to Afghanistan could demonstrably alter this perilous circumstance is delusional. Obama himself does not see only military action as the solution to the problem — though he came across as disturbingly political in tone when he told Canadian television that he still thinks the effort in Afghanistan is “winnable.” The qualification he put on the term winning was to define it as making sure that the region is not a “launching pad for attacks against North America.”

This limited scope should have been the mission all along, which became hopelessly lost in the Bush administration’s grander vision of a global war on terror.

Unfortunately, though Obama has long criticized his predecessor’s record in Afghanistan, he has little time in which to change course. It is not at all clear that a down payment of additional troops will buy him much more of it. He is distracted by the implosion of the economy, with its daily torrent of bad economic news — not to mention clear skepticism in the markets about his various recovery plans, from the stimulus measure to the second round of financial industry bailouts to the newly unwrapped plan to address the foreclosure crisis.

Now Pakistan, our supposed ally, has made a truce with fanatics. But the fanatics are the reason we went to war. They are not the type to wait while the American president copes with the fallout from rotten decisions made by a relative handful of homeowners who could not afford the mortgages they should never have been given by unscrupulous lenders.

In the aftermath of 9/11, one of the few endeavors to be properly executed was the investigation by the commission that probed the origins of the attacks. One of its conclusions was that a singularly dangerous time for the United States occurs during the earliest months of a new presidency: The first attack on the World Trade Center occurred only about a month after Bill Clinton took office; the second just eight months after George W. Bush did.

Obama is correct that there ultimately is no military solution to the terrorist threat. But he’d better come up with another answer, and do so pretty quickly.

Marie Cocco’s e-mail address is mariecocco(at)washpost.com.