KABUL-- Afghanistaninfo-icon's embattled president left the country Sunday, joining his fellow citizens and foreigners in a stampede fleeing the advancing Taliban and signaling the end of a 20-year Western experiment aimed at remaking Afghanistan.

The Taliban entered the capital earlier in the day, and an official with the militant group said it would soon announce the Islamic Emirate of Afghanistan from the presidential palace -- a return rich in symbolism to the name of the country under the Taliban government ousted by U.S.-led forces after the 9/11 attacks. The official spoke on condition of anonymity because he was not authorized to brief the mediainfo-icon.

The insurgents pushed through a city gripped by panic, where helicopters raced overhead throughout the day to evacuate personnel from the U.S. Embassy. Smoke rose near the compound as staff destroyed important documents, and the American flag was lowered. Several other Western missions also prepared to pull their people out.

Afghans fearing that the Taliban could reimpose the kind of brutal rule that all but eliminated women's rights rushed to leave the country, lining up at cash machines to withdraw their life savings. The desperately poor -- who had left homes in the countryside for the presumed safety of the capital -- remained in their thousands in parks and open spaces throughout the city.

Though the Taliban had promised a peaceful transition, the U.S. Embassy suspended operations and warned Americans late in the day to shelter in place and not try to get to the airport.

Commercial flights were later suspended after sporadic gunfire erupted at the airport, according to two senior U.S. military officials who spoke on condition of anonymity to discuss ongoing operations. Evacuations continued on military flights, but the halt to commercial traffic closed off one of the last routes available for Afghans fleeing the country.

Still, U.S. Secretary of State Antony Blinken rejected comparisons to the U.S. pullout from Vietnaminfo-icon, as many watched in disbelief at the sight of helicopters landing in the embassy compound to take diplomats to a new outpost at Kabul International Airport.

"This is manifestly not Saigon," he said on ABC's "This Week."

The American ambassador was among those evacuated, said officials who spoke condition of anonymity because they were not authorized to discuss ongoing military operations. He was asking to return to the embassy, but it was not clear if he would be allowed to.

As the insurgents closed in Sunday, President Ashraf Ghani flew out of the country.

"The former president of Afghanistan left Afghanistan, leaving the country in this difficult situation," said Abdullah Abdullah, the head of the Afghan National Reconciliation Council. "God should hold him accountable."

As night fell, Taliban fighters deployed across Kabul, taking over abandoned police posts and pledging to maintain law and order during the transition. Residents reported looting in parts of the city, including in the upscale diplomatic district, and messages circulating on social mediainfo-icon advised people to stay inside and lock their gates.

In a stunning rout, the Taliban seized nearly all of Afghanistan in just over a week, despite the billions of dollars spent by the U.S. and NATO over nearly two decades to build up Afghan security forces. Just days earlier, an American military assessment estimated it would be a month before the capital would come under insurgent pressure.

The fall of Kabul marks the final chapter of Americainfo-icon's longest warinfo-icon, which began after the Sept. 11, 2001, terror attacks masterminded by al-Qaida's Osama bin Laden, then harbored by the Taliban government. A U.S.-led invasion dislodged the Taliban and beat them back, though America lost focus on the conflictinfo-icon in the chaos of the Iraqinfo-icon War.

For years, the U.S. has been looking for an exit for the war. Washington under then-President Donald Trumpinfo-icon signed a deal with the Taliban in February 2020 that limited direct military action against the insurgents. That allowed the fighters to gather strength and move quickly to seize key areas when President Joe Biden announced his plans to withdraw all American forces by the end of this month.

After the insurgents entered Kabul, Taliban negotiators discussed a transfer of power, said an Afghan official. The official, who spoke on condition of anonymity to discuss details of the closed-doors negotiations, described them as "tense."

It remained unclear when that transfer would take place and who among the Taliban was negotiating. The negotiators on the government side included former President Hamid Karzai, leader of Hizb-e-Islami political and paramilitary group Gulbudin Hekmatyar and Abdullah, who has been a vocal critic of Ghani.

Karzai himself appeared in a video posted online, his three young daughters around him, saying he remained in Kabul.

"We are trying to solve the issue of Afghanistan with the Taliban leadership peacefully," he said.

Afghanistan's acting defense minister, Bismillah Khan Mohammadi, didn't hold back his criticism of the fleeing president.

"They tied our hands from behind and sold the country," he wrote on Twitterinfo-icon. "Curse Ghani and his gang."

The Taliban earlier insisted their fighters wouldn't enter people's homes or interfere with businesses and said they'd offer an "amnesty" to those who worked with the Afghan government or foreign forces.

But there have been reports of revenge killings and other brutal tactics in areas of the country the Taliban have seized in recent days -- and the reports of gunfire at the airport raised the specter of more violence. One female journalist, weeping, sent voice messages to colleagues after armed men entered her apartment building and banged on her door.

"What should I do? Should I call the police or Taliban?" Getee Azami cried. It wasn't clear what happened to her after that.

One Afghan university student described feeling betrayed as she watched the evacuation of the U.S. Embassy.

"You failed the younger generation of Afghanistan," said Aisha Khurram, 22, who is now unsure of whether she'll be able to graduate in two months' time. "A generation ... raised in the modern Afghanistan were hoping to build the country with their own hands. They put blood, efforts and sweat into whatever we had right now."

Sunday began with the Taliban seizing the nearby city of Jalalabad -- which had been the last major city besides the capital not in their hands. Afghan officials said the militants also took the capitals of Maidan Wardak, Khost, Kapisa and Parwan provinces, as well as the country's last government-held border post.

Later, Afghan forces at Bagram air base, home to a prison housing 5,000 inmates, surrendered to the Taliban, according to Bagram district chief Darwaish Raufi. The prison at the former U.S. base held both Taliban and Islamic Stateinfo-icon group fighters.