TAMPA, Fla. (Reuters) - President Barack Obama on Tuesday warned that the United States would not be able to wipe out terrorism with military might as he offered a sweeping defense of his administration’s national security record.

In his final major speech on counterterrorism as president, Obama argued that his administration had been able to make al Qaeda “a shadow of its former self” and had put Islamic State on its heels, but said terrorism would remain a threat to the United States.

“Rather than offer false promises that we can eliminate terrorism by dropping more bombs or deploying more and more troops or fencing ourselves off from the rest of the world, we have to take a long view of the terrorist threat and we have to pursue a smart strategy that can be sustained,” Obama said during a speech at MacDill Air Force Base in Tampa, Florida.

Obama will turn over the White House on Jan. 20 to Republican President-elect Donald Trump who has been sharply critical of his administration’s approach to fighting terrorism.

Trump referred to Obama and Democratic presidential nominee Hillary Clinton as the “co-founders” of Islamic State during the presidential campaign, blaming them for the initial spread of the militant group.

The White House said Obama’s national security speech had been planned long before the Nov. 8 election and was not aimed specifically at the incoming Trump administration.

But during his speech, Obama spoke of the importance of adhering to American laws and values and against reinstating the use of waterboarding or imposing a religious test on immigrants, two positions that Trump has supported in the past.

Slideshow ( 6 images )

“The whole objective of these terrorists is to scare us into changing who we are and our democracy,” Obama said.

Obama signed an executive order after taking office in January 2009 that banned waterboarding and other “enhanced interrogation techniques” or EITs. Such executive orders can be rescinded by a president’s successors.

Many lawmakers and human rights groups have denounced waterboarding, an interrogation technique that simulates drowning, as torture.

While Trump is now calling for “extreme vetting” of certain refugees admitted to the United States, during the campaign he proposed banning foreign-born Muslims from entering the country.

Obama came into office planning to unwind U.S. wars in Iraq and Afghanistan and promising to focus on fighting militant groups that threatened the United States wherever they were.

Instead, he has been forced to return some U.S. troops to Iraq and keep thousands in place in Afghanistan after more than 14-1/2 years of war.

Obama said his administration’s approach of providing support to local partners and not undertaking massive ground invasions has been effective and is making progress in the fight to take Mosul in Iraq from Islamic State.

Some counterterrorism experts have pointed to the rise of Islamic State as an example of Obama being too slow to respond to an emerging threat.

While the United States has been successful in killing some key militant leaders, Obama’s “legacy has been tarnished by the way terrorist groups have regenerated and strengthened in the latter parts of his presidency,” said Robin Simcox, a fellow at the Heritage Foundation.