WASHINGTON — Retired Gen. and former CIA director David Petraeus said Monday the next president should make an “enduring commitment” to continue the U.S. military and diplomatic effort in Afghanistan as an essential part of a broader fight against terrorism.

President Barack Obama announced in July that he would keep 8,500 troops in Afghanistan until the end of his term.

Afghanistan is interlocked with American national security interests in combatting violent extremism, which is why President George W. Bush sent troops 15 years ago and why it’s imperative to stay, Petraeus said during a talk at the Brookings Institution. Making sure that Afghanistan does not become a sanctuary for al-Qaida or other extremist groups is a core objective, he said.

“These efforts in which we’re engaged are a generational struggle, they’re not just the fight of a few years or decades,” said Petraeus, who served as commander of coalition forces in Afghanistan in 2010 and 2011 after serving as Commander of U.S .Central Command. Petraeus resigned as CIA director in 2012 when an FBI investigation found he had provided classified documents to his biographer, with whom he was having an affair.

Petraeus said that Afghanistan is an important platform for regional counterterrorism efforts, noting it was the launching point for the raid that killed Osama Bin Laden.

“What we were seeking to do is to help the Afghans develop the capability to secure themselves and govern themselves…” said Petraeus, “You could not do this with only a counterterrorism operation. It’s always been more than that.”

An October Washington Post-ABC News poll found that 43 percent of Americans opposed Obama’s decision to leave troops in Afghanistan. After 15 years of pouring troops and money into Afghanistan, the direct connection between the effort to stabilize Afghanistan and U.S. security is not proven, CATO Institute Senior Fellow A. Trevor Thrall said in a separate interview.

“The next president should consider that the U.S. presence in Afghanistan is making things worse,” said Thrall. “Our presence is an ongoing cause for radicalization and for anti-American mobilization.”

Petraeus described the situation in the country as “fraught” and “deteriorating,” with increasing pressure from the Taliban and other extremist groups vying to regain control of territories. The U.S. has to lead the effort in supporting Afghan security forces in developing sustainable capacities and also continue air support, Petraeus said.

Thrall disagreed with the validity of the objectives Petraeus outlined-, saying the U.S. should not be leading a nation-building operation. The struggle in Afghanistan has neither prevented the rise of ISIS, said Thrall, nor does al-Qaida pose a continued threat.

Among Petraeus’ recommendations for a long-term American role in Afghanistan was the advice that the new commander-in-chief be patient and not stress annual reviews of whether or not to stay, which tends to make Afghani partners fearful that the U.S. will leave.

Former Ambassador to Afghanistan James Cunningham, who also spoke at the Brookings event, agreed that not being clear about America’s  commitment to Afghanistan “doesn’t just discourage our friends it also encourages our adversaries.”

The number of U.S. troops in Afghanistan has dropped 90 percent from its peak of about 100,000, when Petraeus commanded the surges, large influxes of troops into Afghanistan and Iraq intended to quash through sheer numbers the opposition..  While financial assistance has also been downsized, Afghanistan is the number one recipient of US support with currently $1 billion being given in economic and humanitarian aid and $4 billion to the Afghan security forces, according to a Brookings Institution senior fellow.

The next president will have to take over the challenge of countering the ideology that continues to threaten the region. Petraeus applauded a new State Department initiative in combating violent extremism on social media platforms, but said it isn’t enough.

Staying in Afghanistan is, according to Petraeus and former ambassadors, is essential to fighting terrorists.

“I cant guarantee Afghan success, but I can guarantee what will happen if we leave,” Cunningham said.