By GARDINER HARRIS New York Times

– In his last planned address on national security, President Obama will assert on Tuesday that for eight years his administration protected the homeland against a major terrorist attack while abiding by cherished ideals and bringing most troops home.

The speech is intended as a final answer to years of criticism by Republicans that Obama's sharp break from many of President George W. Bush's policies, including contentious ones such as "enhanced interrogation," would leave the country vulnerable.

"He will be summing up his view of the record of the last eight years," said Benjamin J. Rhodes, a deputy national security adviser to the president. "What we have accomplished, how we have tried to address the threat of terrorism."

The speech was to be delivered Tuesday afternoon at MacDill Air Force Base in Tampa, Fla., home to the United States Central Command and the Special Operations Command, which have been crucial to Obama's fight against terrorism and to efforts to wind down the wars in Iraq and Afghanistan.

Obama will argue that, with terrorist groups a continuing threat years after the Sept. 11, 2001, attacks, the United States needed an approach that was less costly in lives and money than the enormous deployments and constitutionally questionable efforts of his predecessor.

While Obama has been planning the speech for months, President-elect Donald Trump's victory last month made the address all the more vital, as Obama sought to provide a road map for a successor with no experience in national security.

"He will be reiterating that our greatest strength as a country is our values," Rhodes said, and the international system of alliances built over 70 years.

Trump has, on occasion, advocated the use of torture, and he has questioned the value of NATO and other alliances, although he has since modulated those positions.

Obama's speech is bound to attract criticism from Republicans, who will note that while the United States has not had a terrorist attack on the scale of Sept. 11 during his tenure, extremist networks have proliferated around the world and the world is less secure — no place more so than Syria, which is in the sixth year of a horrific civil war and is a base of operations for the Islamic State.

Obama will acknowledge that Syria is a disaster and that Iraq is bleeding, but he will argue that his refusal to send thousands of troops to try to pacify the region was the correct call, and one that spared needless U.S. deaths, Rhodes said.

"We believe that U.S. military intervention — at no time has there been a clear plan where we could see how that could make the situation demonstrably better," Rhodes said.

There have been terrorist attacks in the United States since Obama took office, including one in San Bernardino, Calif., a year ago that killed 14. But they have resulted in far fewer deaths than the Sept. 11 attacks, and they were perpetrated by American citizens inspired by jihadi literature online. Such lone-wolf attacks are extremely difficult to prevent.

Obama vowed early in his first term to close the detention center at Guantanamo Bay, Cuba, a promise he will almost certainly be unable to fulfill. But he will argue that his administration's efforts to capture, convict and imprison terrorists through the civilian criminal justice system have been far more successful than were the military commissions that Bush used, Rhodes said.

Obama, a former professor of constitutional law, will also use the speech, along with a 61-page report released on Monday to portray what has sometimes appeared as an ad hoc, make-it-up-as-you-go fight against myriad terrorist groups, to show that his administration's anti-terrorism efforts were grounded in solid legal reasoning and strict limits on presidential power.

The choice of MacDill to deliver the speech is a symbolic one because so much of Obama's anti-terrorism strategy, including the raid that killed Osama bin Laden, relied on special operations forces. Such troops can be used in small raids and training efforts in ways that do not attract the kind of opposition and attacks that large bodies of forces would.

"He's always felt a special connection to the special forces community," Rhodes said.

James N. Mattis, a retired general whom Trump has nominated as defense secretary, once led the Central Command. But his time there was cut short by the Obama administration, which viewed him as too hawkish on Iran at a time when it was trying to complete a nuclear deal with the country.

Mattis is widely expected to favor sending more troops to the Middle East, a strategy Obama was planning to implicitly criticize Tuesday.