President Obama will visit a military base in Tampa on Tuesday to make a final public defense of his counterterrorism record just hours before Donald Trump introduces his choice of a vocal Obama critic to lead the Pentagon at a rally in North Carolina.The timing of the two events underscores the question of how much of Obama’s approach to national security and fighting terrorism is likely to be upended by his successor.For Obama, the task in Tampa is defending his record at a time of widespread bloodshed and unrest throughout the Middle East, and making the case for continuing the broad contours of his approach after he leaves office.

For Trump and his choice for defense secretary, retired Marine Gen. James N. Mattis, the challenge is to make good on his campaign promise to deploy a more effective strategy against the Islamic State terror organization at a time when Americans are war weary but also increasingly worried about the terror threat from overseas.

Obama began his second term promising to end America’s wars in Iraq and Afghanistan, conflicts that will probably grind on long after he leaves office. More recently, civil wars have ripped apart Libya, Yemen and Syria, sending massive numbers of refugees into Europe and opening up new havens for militant groups such as al-Qaeda and the Islamic State.

Obama’s defense of his record is largely built around the crises he avoided, the large number of troops he brought home from wars in Iraq and Afghanistan, and terrorist attacks that did not happen on his watch.

Today about 15,000 troops are deployed to Iraq, Syria and Afghanistan, down from about 180,000 when Obama took office. “This represents a more sustainable approach,” Ben Rhodes, a deputy national adviser, told reporters Monday. “We have a network of partnerships from South Asia to the Sahel” region of Africa.

The net result is a less costly counterterror campaign with fewer casualties, Rhodes said.

Obama will leave his successor a lethal counterterrorism force that has battered al-Qaeda, including the 2011 killing of Osama bin Laden, and the Islamic State’s leadership ranks, White House officials said. Unlike Europe, the United States has not in recent years been hit with major terrorist attacks planned and directed from Iraq, Syria or Afghanistan. Instead, the threat has come from Muslim Americans who were radicalized through online propaganda.

Rhodes said Obama plans to meet with military leaders at MacDill Air Force Base before delivering a speech that aims to “convey to the incoming team the complexity of looking at all these issues.”

In Mattis, Trump has chosen a former military commander who earlier this year described Obama’s strategy to defeat the Islamic State as “unguided” and “replete with half measures.”

“The bottom line on the American situation is quite clear,” Mattis said in a speech at the Center for Strategic and International Studies last spring. “The next president is going to inherit a mess. That’s probably the most diplomatic word you can use for it.”

Mattis has argued for the United States to take a much tougher stance against Iran, which he described as the “single most belligerent actor in the Middle East.”

“People can argue whether certain polices will be better to address [threats],” Rhodes said. “All we can do is put out why we did what we did and why we believe the approach we have left in the place is the right one. But any new team is going to take a look at that.”

The focus of Obama’s strategy in Iraq and Syria has been to use Special Operations forces and American air power to support local forces on the ground fighting to take back territory from the Islamic State.

At the same time, the president has conducted a major drone campaign to kill terrorist leaders. The president has been “much more aggressive about going after terror networks, wherever they are, than any other president,” Rhodes said. “If he believes he has to use military force to keep the American people safe, he has done that.”

Rhodes emphasized that the speech has been planned for months, but the backdrop has gained added resonance because Mattis’s final Pentagon assignment was as head of the U.S. Central Command, which is headquartered at MacDill along with the U.S. Special Operations Command.

Although White House aides said the speech is not aimed directly at Trump, Obama is hoping to convince his successor to adhere to the broad legal framework he has put in place to combat terrorism. On Monday, the White House unveiled a 61-page compendium of its policies governing the use of force, in hopes that the outline of legal opinions, executive orders and military directives will reduce “the risk of an ill-considered decision,” Obama wrote in an introduction.

The president has been sharply critical of Trump’s campaign rhetoric against “radical Islam” and — in the wake of mass killings in Paris, San Bernardino, Calif., and Orlando — his calls for a temporary ban on Muslim immigrants. Trump also has spoken approvingly of the use of torture methods, including waterboarding.

Obama has said such measures are antithetical to American values and risked driving disaffected Muslim youth to become radicalized.

“He’s accurate in this point,” said Vali Nasr, a former State Department adviser on Pakistan and Afghanistan who heads of the School of Advanced International Studies at Johns Hopkins University. “Alienating the Muslim population is a risky issue. During the George W. Bush administration, there was also talk of Islamofacism, but it was largely directed at challenging Islam in Pakistan or Saudi Arabia. Trump’s primary target is Muslims in the West.”

It isn’t clear exactly what Trump, despite his rhetoric, would change about the president’s approach to counterterrorism. On the campaign trail, Trump said he had a secret plan that would lead to a quick and effective “total victory.”

“I don’t want the enemy to know what I’m doing,” he said.

Mattis has suggested that the United States should devote more resources to the fight against Islamic State, but has not pressed for a major change in the president’s central strategy of relying on local partners.

“I think what we’re doing right now in Iraq, while it may not be sufficient, is certainly on the right path,” he said.

Yet the president’s approach to the Middle East also has drawn criticism from foreign policy experts inside his own party. Brian Katulis, a national security analyst at the liberal Center for American Progress, said Obama too often failed to “articulate something the American public can rally behind. That vacuum, the absence of an affirmative agenda, has left our political system open to all sorts of crazy arguments. That’s a vulnerability that need not have existed.”