President Trump's surprise announcement that he was pulling the U.S. military out of Syria came with no plan in place for what to do about more than 790 imprisoned ISIS fighters and their families. Now his administration is in a frantic search for solutions, including a renewed look at sending the most dangerous fighters to Guantanamo Bay, U.S. and congressional officials tell NBC News.

The scramble has been complicated by the fact that the timeline for the planned U.S. withdrawal keeps evolving, with Trump and his aides giving shifting descriptions of how fast the troops are leaving. The ISIS detainees are being held in Syria by U.S.-backed Kurdish forces, who have warned they may have to let the ISIS fighters go if a feared onslaught by Turkish forces occurs.

Amid the tumult, U.S. diplomats and military officials have been making urgent appeals to foreign countries to take back foreign fighters who went to fight in Syria and were apprehended, so they can be imprisoned and prosecuted in their home countries. It's an appeal the U.S. has been making for several years in anticipation of an eventual U.S. withdrawal, but nearly every country has refused.

The sun rises over Camp Delta detention compound at Guantanamo Bay U.S. Naval Base in 2008. Brennan Linsley / Pool via AFP - Getty Images

Now the U.S. warning to embassies is more desperate: Trump's decision is real, the U.S. is leaving Syria, and the issue must be resolved quickly to ensure ISIS fighters aren't released and rejoin the battle. It comes amid a frenzied effort to turn the president's abrupt decision into workable policy, a period that one former U.S. official described as "chaotic," as officials "search for guidance" from the White House that is not forthcoming.

The White House's National Security Council declined to comment.

The basic understanding of Trump's intentions keeps changing, from a decision to withdraw all troops within a month to a slower withdrawal over four months and now, an exit with no specified timeline. After broad bipartisan concern about a hasty withdrawal, the administration now says some troops could remain in Syria for an indefinite amount of time.

"There are objectives that we want to accomplish that condition the withdrawal," national security adviser John Bolton said Sunday during a trip to Israel.

Amid the shifting policy, the White House has given national security officials no written guidance on how to proceed, several officials said. At a meeting last week with the State Department coordinator for counterterrorism, Nathan Sales, there were no firm answers about what the administration wants to do, officials familiar with the meeting said. The State Department had no comment on the meeting.

Absent any clear instructions, officials are discussing options based on what they presume Trump and Bolton want to hear, one official said. The National Counter Terrorism Center, part of the Office of the Director of National Intelligence, is involved in the planning along with the State Department and the Pentagon.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

To tackle the problem, the U.S. has separated the list of detainees into three categories: most dangerous, mid-level fighters and some leaders, and the more general fighters, according to three U.S. officials familiar with the planning. The most dangerous fighters are the ones under consideration to send to the detention facility at Guantanamo, which the president has repeatedly threatened to "load up" with "some bad dudes."

Karen Greenberg, director of the Center on National Security at Fordham University, says there is precedent for quickly and secretly moving prisoners into Guantanamo Bay.

"Recall what happened in 2001," she said, "the U.S. set up Guantanamo in 96 hours. It could happen very fast."

Greenberg, author of The Least Worst Place, a book about the detention facility at Guantanamo Bay, reminds that the first planeload of detainees arrived in Cuba almost exactly 17 years ago, on January 11, 2002. The current discussions without much actual policy guidance from the White House is reminiscent of the 2001 scramble to find a place to detain nearly 800 fighters.

But unlike in Afghanistan, where the U.S. military collected evidence against al-Qaida fighters as they picked them up on the battlefield, the ISIS fighters in Syria are not in U.S. custody, making it harder to build cases against them that would hold up in the U.S. or other legal systems.

"These detainees were not apprehended by the United States and have no connection to the United States," said Ambassador Lee Wolosky, the former U.S. special envoy for closing Guantanamo in the Obama administration. "They should be returned to their countries of origin for prosecution and incarceration."

The ISIS fighters are being held in makeshift facilities run by the Syrian Democratic Forces, a mostly Kurdish coalition of fighters that the U.S. has relied heavily on for years to fight ISIS on the front lines. Fearing a post-withdrawal onslaught by Turkey, which considers the Kurdish fighters to be terrorists, Kurdish officials have threatened that they might have to simply release the ISIS fighters so they can focus on self-preservation.

Despite that threat, U.S. officials said it's considered unlikely that the Kurdish forces would let the ISIS fighters free – unless Turkey invades to attack them. Turkey considers the U.S.-backed Kurdish forces to be an offshoot of the PKK, a Kurdish group deemed by the U.S. to be terrorists who have waged a two-decade insurgency against Turkey's government.

If Turkey does attack, as has been widely feared in the wake of Trump's decision, the Kurdish forces in Syria would have to redirect all their resources to defending their territory and could release the ISIS prisoners, officials said.

That concern may be one reason that Trump's team is putting a renewed emphasis on trying to prevent Turkish President Recep Tayyip Erdogan from - as Secretary of State Mike Pompeo put it last week - "slaughtering the Kurds."

Ahead of a visit to Ankara, Bolton said an agreement from Turkey not to attack Syrian Kurdish forces was now a prerequisite to a U.S. withdrawal. Erdogan has long sought a U.S. exit from Syria and had offered to Trump that his military would take over and finish off the remaining ISIS fighters operating in Syria, NBC News has reported.

Two of the detainees held in Syria, El Shafee Elsheikh and Alexanda Kotey, are suspected of having taken part in the torture and murder of American and other Western hostages. They were captured one year ago and have been dubbed "the Beatles" because of their British accents.

The Trump administration, at the urging of some Republican lawmakers, has considered transferring them to the Guantanamo detention camp. But Democratic Sen. Jeanne Shaheen of New Hampshire has appealed to the administration to try them in federal courts, arguing that flawed military commissions for Guantanamo inmates have provided fodder for extremist propaganda. Shaheen has worked closely with the parents of James Foley, the American journalist who was murdered by Islamic State in 2014.

The president's "hasty decision to withdraw American forces from Syria betrays the trust that Syrian Democratic Forces have put in the U.S., and risks unraveling our efforts to bring these terrorists to justice," Shaheen told NBC News in an email.

Another major dilemma facing the administration: more than 2,000 family members of ISIS fighters who also must be dealt with. The wives and children are not in prison but in separate sections of camps in Syria for internally displaced people, officials said.

A few countries, including France and Belgium, have started talking about taking back some of the families who originated from their countries, but the problem is far from solved.

Human rights groups have insisted the issue must be solved before the U.S. forces come out, arguing that local Kurdish authorities are not equipped to keep holding them or put them on trial. But Human Rights Watch also emphasized that detainees should not be transferred to countries known to practice torture or for tainted court trials, including neighboring Iraq, where the group said the U.S. has already sent at least five of the detainees.

"The issue of the foreign detainees – men, women and children – should be a key priority for any planning for U.S. withdrawal from northern Syria, said Nadim Houry, who runs the group's terrorism and counterterrorism program. "The local authorities in northern Syria should not be left to deal with this international issue on their own."