The State Department has struggled to get a handle on the number of Americans still in Afghanistan. This is not a problem of its making, or at least not primarily of its making. In conversation with White House and State Department officials over the past few days, I got a glimpse of the scope of the effort to identify and evacuate them.

First, State had to imagine a universe of as many as 15,000 Americans — those who at any time over the years voluntarily registered with the State Department — though it anticipated that the real number of Americans still in country was far smaller. (State pointed out that not all Americans register or deregister.)

While the State Department has been criticized for not beginning mass evacuations of Afghans months ago (which in all likelihood would have triggered an earlier collapse of the government), as far back as April, it began sending one notice after another containing dire warnings to Americans, imploring them to consider the coming pullout. (“U.S. citizens wishing to depart Afghanistan should leave as soon as possible on available commercial flights,” a State Department communication warned on April 27.) Many Americans ignored these warnings.

When the Afghan government did collapse, evacuation efforts switched into high gear and went global. In a 24/7 push, approximately 500 State Department consular officials not only in Kabul but also around the world began the excruciating process of going through the thousands of names of Americans who could be in Afghanistan. Personnel in Mexico City and New Delhi took part. Ten junior consular officers in Ottawa volunteered, returned to Foggy Bottom and started making calls. The State Department also heard from retirees willing to help.

With round after round of calls, emails and texts — and with public messaging for Americans to identify themselves — State narrowed the list of Americans still in country to about 6,000. With the Aug. 31 withdrawal deadline approaching, every individual on the roster who has not yet been in contact has received some sort of message at least once a day.

Despite the logistical nightmare of reaching Kabul’s international airport — and the challenge of organizing an airlift in which, at the operation’s peak, a plane was taking off every 45 minutes (or less) — by midweek the number of Americans in Afghanistan was reduced to 900. By Sunday, Secretary of State Antony Blinken could say on ABC’s “This Week”: “We have about 300 American citizens left who have indicated to us that they want to leave. We are very actively working to help them get to the airport, get on a plane and get out of Afghanistan.” (By Sunday afternoon, a State official told me, the number was more like 250.)

In some cases, State Department employees had multiple conversations in a single day with a single American who was vacillating between staying and leaving. While Americans might find it incredible that anyone would want to stay, those still in Afghanistan (some dual nationals, some green-card holders) had to weigh factors including the fate of extended family, the prospect of severing communal ties and their hopes of building Afghanistan’s future.

When the last plane takes off with evacuees, it is possible some of the 250 might not make it out. It is also possible, though not probable, that some Americans who never registered and never contacted the State Department — or who registered but failed to respond to all those emails, texts, calls and public messages — will remain and still want to leave. Some Americans who said they wanted to stay could change their minds.

What’s the plan for them? As you might imagine, the administration has been vague on its ironclad promise to get Americans out. On “Meet the Press” on Sunday, Blinken was cagey, declining to provide details of the “mechanisms” State might have. There certainly remains the possibility of rescue operations.

In addition, Blinken said that 114 countries had signed on to a U.S.-initiated joint statement in which they reaffirmed the Taliban’s promise to allow their “citizens, nationals and residents, employees, Afghans who have worked with us and those who are at risk” to “continue to travel freely to destinations outside Afghanistan” after the Aug. 31 deadline. Blinken noted:

That freedom of travel is essential to the international community’s expectations of the Taliban going forward. And working with other countries very closely, we’re going to make sure that we put in place the means to do that. An airport that functions, other ways of leaving the country, all of that is what we’re working on in the days ahead.

Blinken’s statement has been treated with skepticism, even scoffing, especially from Republicans insistent that the administration has “abandoned” our people. But the Taliban by and large did allow nearly 6,000 Americans to reach the airport. Yes, American troops were at the airport and ready to respond, but it was evident to anyone watching the operation over the last couple of weeks that the Taliban did not fancy getting into a spat with the international community about refusing to let other countries’ citizens, nationals and residents out. (Afghans who might qualify for special immigrant visas or other priority categories are a separate matter.)

If the Taliban has any hope of remedying its desperate economic situation and avoiding retaliatory action, it has little reason to hold any American against his or her will. Could there be fights about dual nationals? Could some Americans face physical abuse? Absolutely. We lost a war to a vicious, anti-Western group whose control of the country is shaky (as the suicide attack by the Islamic State-Khorasan showed).

It is interesting, however, to compare the Afghanistan effort with prior evacuations of Americans. In 2015, the United States did not evacuate Americans as Yemen descended into chaos. (“Although many other countries evacuated their citizens, India most notably ferrying out around 5,000, the United States has said it is too dangerous for them to directly evacuate American nationals,” CNN reported in April of that year.) Likewise, when Libya fell apart in 2011, the United States ferried out a meager 167 Americans, give or take. (Tens of thousands of third-country nationals were stranded in the chaotic fighting.)

The media entrenched in the narrative that the Afghanistan operation is a “failure” may very well speculate about Americans left behind. A few Americans may even pop up after Aug. 31, which will test the commitment to bring every American home. But the herculean effort to extract thousands of Americans after the Taliban seized control of the country should not go unnoticed or unappreciated.