WASHINGTON — The Trump administration’s peace deal with the Taliban opens the door for an initial American troop withdrawal that Defense Secretary Mark Esper sees as a step toward the broader goal of preparing for potential future war with China.

Esper has his eye on “great power competition,” which means staying a step ahead of China and Russia on battlefields of the future, including in space and in next-generation strategic weapons like hypersonic missiles and advanced nuclear weapons. He sees China in particular as a rising threat to American predominance on the world stage.

To do more to prepare for the China challenge, Esper wants to do less in Afghanistan, Iraq and other places. It’s less about moving troops directly to Asia from elsewhere in the world, and more about reducing commitments in lower-priority regions so that more military units can train together at home on skills related to conventional warfare. Predecessors in the Pentagon have had similar hopes, only to be drawn back to crises in the greater Middle East. In the past year alone, the U.S. has sent an extra 20,000 troops to the Middle East, mainly due to worries about Iran.

With President Donald Trump’s emphasis on ending America’s wars against extremists and insurgents, including in Afghanistan, Esper wants to bring home as many troops as he thinks he prudently can so they can prepare for “high end” warfare.

Stephen Biddle, a policy analyst and a Columbia University professor of international and public affairs, is skeptical that the Pentagon will be able to fully shift away from Afghanistan and other regional hot spots like Iraq, recalling that the Obama administration tried the same thing — also with China’s rise in mind — in the 2011-2014 period.

“The trouble was the Islamic State burst onto the scene,” in Iraq and Syria, Biddle said in an interview, and “lo and behold it was right back to a focus on the Middle East and small wars.”

In remarks Saturday in Kabul, Esper kept the focus on prospects for a complete U.S. withdrawal, while cautioning that the United States “will not hesitate” to strike what he called terrorist threats in Afghanistan if the Taliban falters in its promise to prevent extremist groups to use Afghan soil to launch attacks on the homelands of the U.S. or its allies.

“We still have a long way to go,” Esper said.

Reducing U.S. troops levels in Afghanistan to zero is “our ultimate objective,” he said, but added that it will take “many months.”

Late last year, Esper said he would be willing to reduce troop levels even if no deal could be made with the Taliban.

“I would like to do that because what I want to do is reallocate forces to” the Asia-Pacific region, he said at the Ronald Reagan National Defense Forum in December. He said he wants to do the same thing in the Mideast, Africa and Europe.

“All of these places where I can free up troops where I could either bring them home to allow them to rest and refit and retrain or/and then reallocate them (to the Asia-Pacific region) to compete with the Chinese, to reassure our allies, to conduct exercises and training,” he said.

The Pentagon has not publicly spelled out a precise timetable for troop reductions in Afghanistan, but Esper has said the peace deal signed Saturday in Doha, Qatar by American officials and Taliban representatives triggers the start of a drawdown from the current total of nearly 13,000 to about 8,600, similar to the number Trump inherited when he entered the White House three years ago. The reduction won’t happen immediately; it will be carried out over a period of several months and could be slowed, stopped or even reversed if peace prospects turn sour.

Secretary of State Mike Pompeo on Sunday said the U.S. will hold the Taliban and Afghan national security forces to their commitments to reduce the level of violence and predicted a “rocky and bumpy” path ahead. “It’s not about trust, it’s about what happens on the ground not only yesterday, which was an important day, but in the days to follow,” he told CBS’ “Face the Nation.”

Gen. Mark Milley, chairman of the Joint Chiefs of Staff and a former commander of U.S. forces in Afghanistan, told a House committee on Wednesday, “The whole thing is dependent upon conditions and dependent upon Taliban behavior.”

A U.S. withdrawal, while conditioned on Taliban compliance, raises questions not just about the country’s stability but also the prospects for continuing to combat non-Taliban extremists such as al-Qaida and the Islamic State affiliate in Afghanistan. Some in Congress, including Republican Rep. Liz Cheney of Wyoming, are pressing Pentagon officials for assurances that they will not cooperate or coordinate with the Taliban as a counterterror partner.

It would be “lunacy,” Cheney said Wednesday, to trust the Taliban, which was running Afghanistan and harboring al-Qaida when U.S. forces invaded in October 2001. As part of the negotiated deal with Washington, the Taliban promised not to let al-Qaida use the country as a staging ground for attacking the United States or its allies.

If the peace process succeeds and the U.S. ends up withdrawing entirely, it might opt for an “over-the-horizon” counterterrorism force. In that case, U.S. special operations troops would be stationed in one or more nearby countries such as Uzbekistan and slip in and out of Afghanistan when necessary to monitor or to attack al-Qaida or IS fighters.

It was the Taliban’s close association with al-Qaida, after the terrorist group led by Osama bin Laden carried out the Sept. 11, 2001, terrorist attacks on the United States, that prompted President George W. Bush to invade Afghanistan a month later.

U.S. force levels in Afghanistan ebbed and flowed over the years. Early on, the Americans hoped that a small force could keep a lid on al-Qaida and train an Afghan army. But from about 2,500 troops at the end of 2001, the force jumped to about 22,000 five years later. President Barack Obama ballooned the number from about 34,000 at the start of his first term to 100,000. By the time he left the White House the number had dropped to 8,400.

Trump entered office in January 2017 with no appetite for continuing the Afghan stalemate. He was persuaded, nonetheless, in August 2017 to add several thousand troops as part of what he called a new strategy for the region. That included designating Zalmay Khalilzad, a former U.S. ambassador to Kabul, to lead negotiations with the Taliban that eventually produced Saturday’s deal and a chance for the United States to move beyond Afghanistan.