Defense Secretary Jim Mattis recently made a big change to the rules of engagement for U.S. troops in Afghanistan.

In short, U.S. troops are now allowed to shoot first when they find Taliban insurgents or Islamic State militants.

That’s a major shift from the Obama-era rules of engagement that often required U.S. forces to “basically be in contact with that enemy” before getting authorization for airstrikes or artillery strikes, Mattis said.

Loosening those rules of engagement will be welcome news to many U.S. troops. For years, we’ve heard from service members — on the ground and in the air — who say they’ve missed good opportunities to take out enemy targets because lawyers in the rear refused to approve strikes.

And, even worse, we’ve heard stories of troops who were punished for making good-faith, split-second decisions that, in the hindsight of senior officers, were found to be in violation of the restrictive rules of engagement.

Calibrating rules of engagement is no easy task. But the pendulum had clearly swung too far in the wrong direction after 16 years of war.

What started out with “shock and awe” and a kick-in-the-door mentality eventually changed dramatically and gave way to heightened concerns about “hearts and minds” and civilian casualties.

In the eyes of many troops on the ground, that looked a lot like politically constrained paralysis.

More broadly, Mattis’ decision to loosen the rules of engagement may be a final repudiation for the “COINdinistas,” the soldier-scholar types led by retired Gen. David Petraeus whose Big Idea of counterinsurgency doctrine seized the Pentagon about a decade ago.

The “population-centric” approach that was touted as a “new way of war” was all the rage back then. But its credibility is undermined by the basic fact that we are still in Iraq and Afghanistan, fighting the same enemies.

To be sure, not every problem has a military solution. Petraeus and others culled some valuable lessons learned from the numerous mistakes of the early post-9/11 era. But Mattis’ decision suggests that maybe warfare in the 21st century is not so different than it was in the past. The main goal is still to close with and kill the enemy.

Today’s troops can be thankful that the civilian in charge of the Pentagon these days is himself a former enlisted Marine who spent many years at the tip of the spear.