Editor's note: Peter Bergen is CNN's national security analyst and a fellow at the New America Foundation in Washington and at New York University's Center on Law and Security. His most recent book is "The Osama bin Laden I Know: An Oral History of al Qaeda's Leader."
(CNN) -- We are losing in Afghanistan, on two fronts. The most important center of gravity of the conflict -- as the Taliban well recognizes -- is the American public. And now, most Americans are opposed to the war.
For years, Afghanistan was "the forgotten war," and when Americans started paying attention again -- roughly around the time of President Obama's inauguration -- what they saw was not a pretty sight: a corrupt Afghan government, a world-class drug trade, a resurgent Taliban and steadily rising U.S. casualties.
Many surely thought: Didn't we win this war eight years ago?
Americans, of course, hate seeing the deaths of fellow citizens in combat, but even more they hate to see those deaths in the service of a war they believe they are either not winning or maybe even losing, which is one of the reasons why they largely turned against the Iraq war in 2006.
Within a couple of years, Iraq came back from the brink and started to turn around, after which the war there became largely a nonissue for most Americans. Similarly, the American public would be more likely to tolerate the losses of blood and treasure in Afghanistan if they saw real progress being made there. And right now, they don't.
The second front we're losing is the Afghans themselves, who are the United States' center of gravity in the Afghan war. Eight years into this conflict, America and its NATO allies -- who are still looked on favorably by a majority of Afghans -- are not providing large swaths of the Afghan population with the most basic public good, which is security.
It's time to table fancy counterinsurgency doctrines about "connecting the Afghan people to the government" -- Afghans have never had, and don't expect much, in the way of services from their government, and it's time now to focus on something much more basic: security.
The last government to provide Afghans with real security was ... the Taliban. When they ruled the country before 9/11, security came at a tremendous price: a brutal, theocratic regime that bankrupted the country and was a pariah on the world stage.
But in the context of Afghan history, the Taliban bringing security was decisively important, since what had immediately preceded their iron rule was a nightmarish civil war during which you could be robbed or killed at will by gangs of roving ethnic and tribal militias.
It is has been a staple of Western political theory since the mid-17th century, when Hobbes wrote "Leviathan," that if the state does not provide security to its people, life will be "nasty, brutish and short." Hobbes wrote "Leviathan" in the shadow of the English Civil War, deriving from that bloody conflict the idea that the most important political good the state can deliver is security.
The United States relearned this lesson in Iraq with some success starting in 2007. But the U.S. seems to have developed instant amnesia about this issue in Afghanistan, where around 40 percent of the country was controlled by the Taliban or was at high risk for attacks by insurgents, according to a private assessment prepared by the Afghan military in April, which was obtained by CNN.
A glaring symbol of the collapse of security in the country is the 300-mile Kabul-to-Kandahar highway, economically and politically the most important road in the country, which is now too dangerous to drive on.
Who will then provide security? The Afghan army is relatively small and generally ineffective. The police are worse. The plans to ramp up the size and efficacy of those forces are, of course, a key part of the American exit strategy from the country. But that training mission is going to take years. Nor are NATO allies going to add significantly more troops. Indeed, a number of NATO countries are already heading to the exits.
That means that it now falls to the United States to do the heavy lifting in Afghanistan, and if Obama is serious about securing the country and rolling back the Taliban, he really doesn't have much choice but to put significant numbers of more troops on the ground. That way, he can start winning the war: win back the American public, roll back the Taliban -- who have melded ideologically and tactically with al Qaeda -- and provide real security to the Afghan people.
Such a ramp-up will have an additional benefit. In the larger war on al Qaeda and its allies, the center of gravity is the Pakistani public, military and government because it is in Pakistan where al Qaeda and its Taliban allies are headquartered. And in one of the most important strategic shifts since 9/11, the Pakistani military and government are now getting serious about wiping out large elements of the Taliban and allied groups on their territory and, most importantly, are doing it with the support of their population.
No longer are Pakistani military operations against militants in Swat and Waziristan seen by Pakistanis as "America's war": they are now seen as being in the vital interests of the Pakistani state because the Pakistani Taliban and other jihadist groups have made major strategic errors since early 2009, including marching close to Islamabad, attacking Pakistan's equivalent of the Pentagon and killing hundreds of Pakistani soldiers and policemen.
This new development is vitally important. Over the years, U.S. military commanders have often talked about hammer and anvil operations in eastern Afghanistan and western Pakistan that would bring an American hammer down on the militants based along the Afghanistan-Pakistan border, who would then in turn be caught on a Pakistani anvil.
In reality, the American hammer was never large and the Pakistani anvil was never strong.
But the ongoing Pakistani military incursion into Waziristan, which was preceded by months of "softening up" operations with air strikes and artillery as well as a ramped-up American drone program aimed at al Qaeda and Taliban leaders there, is today setting the conditions for a real anvil.
The hammer must now be applied.
Armed groups don't sue for peace when they believe they might have the upper hand, and right now, the Taliban feel that they are winning the war -- or at least not losing it, which for most insurgencies amounts to the same thing. If there is to be some kind of political reconciliation with elements of the Taliban, that will only come once they truly believe they have no prospect of military success.
At the same time, key roads, cities and towns in Afghanistan must also be secured. Without providing that security, as Hobbes wrote three and half centuries ago, governments of any kind will fail at their most basic task.
The opinions expressed in this commentary are solely those of Peter Bergen.