Former Defense Secretary Robert Gates believes there is a "real risk" that if American troops are pulled out of Afghanistan, the Taliban might retake control of the country. He told "Face the Nation" host Margaret Brennan that the U.S. should ensure that the Afghan government is stable before bringing American forces home. There are currently 12,000 U.S. service members stationed there.

"I think that the circumstances under which you bring them home matter. And I think trying to give the Afghan government the best possible shot at survival is really important for the future of Afghanistan," Gates told Brennan. He outlined potential consequences of the Taliban retaking control of the country, particularly the reduction of women's rights.

The 2001 U.S.-led invasion helped women secure fragile freedoms under a new constitution, which was crafted after the Taliban was ousted from power along with its brutal interpretation of Islamic law. Recently the Taliban has said it will now allow women to attend school and hold jobs.

"So the question is, can you negotiate an arrangement whereby the Taliban agrees to operate under the Afghan Constitution, becomes a part of the political process?" Gates asked.

When asked by Brennan if the Taliban has interest in joining such a government or if it just wants to rule the country itself, Gates acknowledged that the Taliban wants to "take over Afghanistan."

"If they agree to any kind of a compromise deal, it's really up to the other Afghans at the end of the day to- to resist any moves, to get rid of those changes, to go backward, if you will," Gates continued. Gates talked to Brennan on Friday, just hours before the administration announced it would move $1.5 billion designated for the war in Afghanistan to build a border wall.

The U.S. is currently involved in negotiations with the Taliban to end the 17-year war in Afghanistan, although it has not included the current government of Afghanistan in those talks. That exclusion from direct talks has caused a rift in relations between President Ashraf Ghani and U.S. negotiator Ambassador Zalmay Khalilzad. The U.S. recently reached an agreement in principle with the Taliban that in exchange for them agreeing not to again harbor terrorists like al Qaeda, the U.S. would withdraw U.S. troops. It led to accusations that the Trump administration is rushing into a bad deal that could leave the U.S.-backed Ghani government vulnerable.

The level of distrust reached a fever pitch in March when Afghanistan's top national security official accused the Trump administration of conspiring to unseat elected Afghan President Ashraf Ghani and replace him with a colonial-style government led by Khalilzad. The Trump administration flatly denied it.

In a tweet responding to the allegations, Khalilzad said, "Peace requires agreement on four issues: counter-terrorism assurances, troop withdrawal, intra-Afghan dialogue, and a comprehensive ceasefire. In January talks, we 'agreed in principle' on these four elements. We're now 'agreed in draft' on the first two." He went on to say that once the agreement is finalized, the Taliban and "other Afghans including the government" will begin talks.

Gates suggested the U.S. needs to ensure that there is a peace plan between the Taliban and the government in place before U.S. troops leave Afghanistan, although ultimately it will be up to the Afghans to enforce it.

"I think it's up to us after all this time to at least try and put the Afghan government in as positive a position for that contest that will come at some point as we can. But at the end of the day, you've got to admit, it's going to be up to the Afghans themselves," Gates said.

Brennan asked whether it was reasonable to compare U.S. involvement in Afghanistan to the war in Vietnam, which ended with U.S. withdrawal and a subsequent communist takeover of the country.

"The former U.S. Ambassador to Afghanistan, Ryan Crocker, who you know well, compared this to Vietnam. He said, 'You pull out your troops, it doesn't end the war. That hands the battlefield to your adversaries.' Do you see that?" Brennan asked.

"I think there's a very real risk of that, yes," Gates replied.

"A repeat of Vietnam?" Brennan asked.

"Well, a repeat of the government that we have supported being unable to sustain itself," he said.

Margaret Brennan's interview with former Defense Secretary Robert Gates took place on the College of William & Mary campus, where Mr. Gates is serving in his second term as Chancellor.