President Trump spent the 2016 campaign slamming the folly of getting US forces bogged down in nation-building missions in Middle East quagmires. But he also promised to fight terrorism hard — and that vow explains why he’s likely to soon order several thousand more troops to Afghanistan.

His predecessor proved the folly of doing otherwise.

President Barack Obama labored under the delusion that he could somehow separate the fight against the Taliban from the war on al Qaeda and other Islamist terrorists. But the Taliban wasn’t interested in deals. Instead, it waited for Obama to make good on his promise to start withdrawing US forces, then went on the offensive.

More than a third of the country is now either held by the Taliban or seriously contested by it or other Islamists like the Haqqani Network and ISIS, with more ground being lost all the time. Deploying more US troops is the obvious answer.

Another change from Obama: Trump is willing to let the military do its job without micromanaging from the White House.

The United States can’t fix all that’s wrong with Afghanistan, but refusing to wave the white flag when it comes to fighting Islamic terrorists isn’t nation-building.

We already know what happens when America steps out of the struggle against these brutal foes. That’s what let the Taliban rise to power in the ’90s and play host to al Qaeda as it plotted the 9/11 attacks. Later, Obama’s bugout from Iraq allowed the rise of ISIS.

Trump is stuck handling the mess Obama left him in Afghanistan. By OK’ing the troop increase, he’ll be facing up to his responsibility to carry the fight to our enemies — rather than waiting for them to attack us again.