ONE OF the few things that Presidents George W. Bush and Barack Obama have in common is that they reversed their long-standing approaches to counterterrorism during their very last years in office. They initially held diametrically opposed military policies, with Bush choosing invasion and occupation and Obama preferring disengagement and drone strikes. But by the end of their second terms they had both ended up in roughly the same place, with a central focus on indirect action—enabling local forces to achieve U.S. counterterrorism objectives.

Through long periods of trial and error, constrained by a common reluctance to change course, but in the end having their hands forced by growing terrorist threats and events spiraling out of control, both presidents finally came to adopt the only set of counterterrorism policies that have been shown to succeed over the long run. It is important that President Donald Trump avoid repeating this painful and time-consuming learning curve.

Doing so will require him to accept lessons from his predecessors’ experiences. President Bush’s central mistakes are relatively easy to avoid. Simply follow the advice offered repeatedly by strategists from Gen. Douglas MacArthur to Secretary of Defense Robert Gates and, if at all possible, avoid having American forces fight large conventional land wars in Asia. Eventually, President Bush largely extricated the United States from his self-dug hole through the combination of shifting to counterinsurgency operations, cultivating the Sons of Iraq, building the Iraqi Counter Terrorism Service and supporting the revolution in U.S. special-operations targeting led by Gen. Stanley McChrystal. But the success of “the surge” came only after the deaths of hundreds of thousands and the explosion of Salafi jihadist terrorism. It is difficult to argue that Al Qaeda in Iraq and the Islamic State would have emerged in the absence of the initial U.S. invasion and occupation of Iraq.

From the outset of his administration, President Obama clearly learned this lesson and was appropriately wary of any policy proposal that risked starting down the proverbial “slippery slope” to a large conventional land war. Even as the frequency of drone strikes against terrorists in multiple countries greatly expanded, he consistently stressed the need to marry these discrete direct actions to wider campaigns focused on indirect action. Obama seemed to understand that while U.S. direct actions can disrupt and even degrade foreign terrorist or insurgent groups, they rarely defeat and almost never destroy them. In military terms, direct action is a necessary line of operation, but indirect action is the decisive line of operation.

Some have caricatured this emphasis on indirect action as “leading from behind” and dismissed it as somehow being a sharp break from American tradition. This critique is itself ahistorical and more than a little ironic, since indirect action was a central element of the Reagan Doctrine that supported anti-Communist fighters in Afghanistan—which itself took a page from the Truman Doctrine that supported anti-Communist fighters in Greece. In both cases, the United States successfully enabled others to fight to meet its own national-security objectives.

But given the mixed record of the Obama administration—and the near certainty that future presidents will also want to combat terrorists indirectly rather than send hundreds of thousands of U.S. troops to occupy another country—it is critical that the Trump administration officials understand why indirect-action campaigns can fail, and what those same policymakers can do to maximize their likelihood of success.

SOME RECENT U.S. military campaigns focused on indirect action have been remarkably successful and thus attracted bipartisan support. Plan Colombia, which began under President Bill Clinton and expanded under President Bush, provided U.S. arms and advisers to fight the FARC, a group officially designated by Democratic and Republican administrations alike as both a terrorist organization and a leading drug cartel. This effort helped bring Colombia back from being a failed state in the 1990s and provided the necessary prerequisite to the recent agreement that promises an end to the Western Hemisphere’s longest insurgency. Less well known, but similarly successful, was the support provided by the Joint Special Operations Task Force in the Philippines under Presidents Bush and Obama. This task force, which was officially shut down in 2015 after over a decade of operation, sharply reduced the threat from terrorists allied with Al Qaeda and now the Islamic State, and improved the capacity of the Philippine armed forces to combat those who still remain in Mindanao.

Indirect action currently defines U.S. counterterrorism policy throughout Africa. Campaigns led by U.S. special-operations forces are successfully supporting counterterrorism operations by the African Union in Somalia, by the French and their partners across the Sahel, by the Ugandans against the Lord’s Resistance Army, and, most recently, by a multinational West African force in Cameroon against Boko Haram. These campaigns are far from complete, but have made real progress in degrading the capabilities of al-Shabaab, Al Qaeda in the Islamic Maghreb, and Joseph Kony and his followers.

But these accomplishments of the Obama administration are understandably outweighed in public perceptions by the high-profile failures in Yemen, Libya, Syria and Iraq. Washington promised to build a Libyan military that never materialized, announced an effort to train Syrian rebels that failed completely, supported a Yemeni government that crumbled before a Houthi insurgency, and spent billions training and equipping an Iraqi military that fled in the face of Islamic State. In each case, the terrorist organizations expanded their geographic areas of control, and the United States eventually found itself forced to engage in the types of direct military operations that it had previously precluded. Even in Afghanistan, the beneficiaries of over a decade of U.S. training and equipping have proven incapable of fighting the Taliban—or the relatively new local affiliate of the Islamic State—without continued U.S. support. And as a result, just as was the case with Iraq, President Obama eventually had to reverse his prior restrictions on U.S. military operations in Afghanistan.

Of course, when indirect-action campaigns fail, it is usually due to the weaknesses endemic to the political leaders and fighting forces that the United States is supporting, whether a national military, an irregular unit or a local authority. After all, it’s typically those with the deepest problems who most desperately need support. And even when American surrogates are militarily effective, their efforts may ultimately be for naught if wider political disputes prevent the conflict’s resolution. When compared with unilateral U.S. combat operations, indirect action works on a longer timescale and carries with it a higher risk of failure than many would prefer.

But it is inaccurate—and deeply unfair to those fighting and dying on the front lines against common enemies—only to blame others’ shortcomings for the inability of the United States to achieve its own military objectives through indirect action. Indeed, too often U.S. policymakers’ own decisions, made initially with the best of intentions, end up setting the stage for a subsequent failure. And these types of outcomes can be doubly tragic; when an indirect-action campaign fails, the remaining viable counterterrorism options can be particularly unappealing, as the Obama administration experienced firsthand.

After reviewing the recent record of successes and failures of the use of indirect action to combat terrorists, a few clear lessons emerge for U.S. policymakers. To maximize the probability of success, they must recognize the need to take action earlier than they might prefer. They must be willing to accept a greater and wider array of risks, both physical to military personnel in the field and political to leaders inside the Beltway. They must align themselves more fully with the interests of foreign partners rather than limiting actions to serve only U.S. interests. They must agree to delegate operational and tactical decisions to leaders in the field rather than micromanage them in Washington. They must integrate military actions with equally aggressive diplomatic strategy. And they must remain firmly and publicly committed to stay the course over an extended period of time. Easier said than done.

IT IS axiomatic that the best time to start an indirect-action campaign is before the threat has spiraled out of control. It takes considerable time to improve local forces’ military capabilities and even longer to build the necessary personal trust. Indeed, sometimes the window of opportunity for such an approach closes relatively early, especially if local actors become frustrated and increasingly distrustful after having multiple requests for U.S. assistance denied. It is better, therefore, to have a persistent but modest U.S. military, law-enforcement and intelligence presence operating largely out of the embassy, looking for emerging opportunities to partner with trusted locals committed to fighting terrorists. Because of the small size of the deployment and the unique nature of special-operations forces, the military component of this outfit can usually operate under something just short of a full status-of-forces agreement. Ideally, to ensure redundancy when setbacks emerge, multiple agencies would be working with various foreign partners in a given location, all coordinating under the U.S. ambassador and with the CIA’s station chief.

Similarly, it’s usually more effective to begin by building a small, local force than by attempting to train large foreign armies in scale. There are countless examples of U.S. special operators, law-enforcement agents (especially from the Drug Enforcement Administration) and other U.S. personnel successfully building elite, specialized foreign surrogates. But there are, arguably, no examples of the United States successfully taking the lead at building another country’s military in very large numbers from near scratch—as was the initial plan in Libya. American training can augment other countries’ concerted efforts to build their own forces in scale, but it cannot accomplish this for them. By focusing instead on building relatively small, but especially capable, surrogate counterterrorist units, the total number of U.S. personnel sent into the field can also be kept relatively small.