US President Barack Obama has warned that the country 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, Mr Obama argued that his administration had been able to make al-Qaeda "a shadow of its former self" and had put the self-proclaimed Islamic State group on its heels.
However, he 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," Mr Obama said during a speech at MacDill Air Force Base in Tampa, Florida.
On 20 January Mr Obama will turn over the White House to Republican President-elect Donald Trump, who has been sharply critical of his administration's approach to fighting terrorism.
Mr Trump referred to Mr Obama and Democratic presidential nominee Hillary Clinton as the "co-founders" of IS during the presidential campaign, blaming them for the initial spread of the militant group.
The White House said Mr Obama's national security speech had been planned long before the result of the 8 November election was known and was not aimed specifically at the incoming Trump administration.
But during his speech, Mr 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 Mr Trump has supported in the past.
"The whole objective of these terrorists is to scare us into changing who we are and our democracy," Mr Obama said.
Mr 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 Mr Trump is now calling for "extreme vetting" of certain refugees admitted to the US, during the campaign he proposed banning foreign-born Muslims from entering the country.
Mr Obama came into office planning to unwind US wars in Iraq and Afghanistan and promising to focus on fighting militant groups that threatened the US wherever they were.
Instead, he has been forced to return some US troops to Iraq and keep thousands in place in Afghanistan after more than 14-1/2 years of war.
Mr 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 IS.
Some counterterrorism experts have pointed to the rise of IS as an example of Mr Obama being too slow to respond to an emerging threat.
While the US has been successful in killing some key militant leaders, Mr 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.