Chaos is unfolding in Afghanistan. Here's what you need to know.

A version of this story appeared in CNN's What Matters newsletter. To get it in your inbox, sign up for free here.

Washington (CNN)The Taliban edged closer to solidifying control of Afghanistan on Sunday, including entering the presidential palace in Kabul hours after former President Ashraf Ghani fled the country.

The rapidly-evolving situation has prompted confusion and concern as the US and governments worldwide monitor the bitter end to nearly two decades of war.
Here's what you need to know about what happened this weekend and how we got here.

    Where things stand

      The presidential palace in Kabul has now been handed over to the Taliban after being vacated just hours earlier by officials of the US-backed government. The Taliban claimed the palace with three Afghan government officials present, according to Al Jazeera, which carried events live. One Taliban security official said there was a "peaceful handover of government facilities ongoing across the country."
        Another spoke briefly in English to say that he had formerly been held by the US in Guantanamo, a claim that CNN cannot independently verify.
        Afghan President flees. Ghani left the country on Sunday for Tajikistan, two sources told CNN.
          Afghanistan's acting defense minister, General Bismillah Mohammadi, slammed the fleeing president in a brief tweet Sunday, writing: "They tied our hands behind our backs and sold the homeland, damn the rich man and his gang."
          US embassy evacuated. Early Sunday, two sources familiar with the situation told CNN that the plan was to pull all US personnel from the embassy in Kabul over the next 72 hours. But hours later, most US embassy staff had been moved to the Kabul airport for flights out of the country. The US flag is no longer flying over the building. More on the diplomatic evacuation here.
          Foreign governments scrambling. The airport has become the focus of much international attention as foreign governments work to evacuate citizens.
          Following reports of gunfire at the airport, the US embassy instructed all American citizens still in the country to shelter in place. "The security situation in Kabul is changing quickly including at the airport," it said in a security alert. "There are reports of the airport taking fire; therefore we are instructing US citizens to shelter in place."

          How we got here

          The US withdrawal from the country opened a clear path for the Taliban to take on and defeat the Afghan security forces. Many major cities fell with little to no resistance, including the key city of Jalalabad, which the Taliban seized on Sunday.
          Biden officials admit miscalculation. The rapid fall of Afghanistan's national forces and government has come as a shock to President Joe Biden and senior members of his administration, who only last month believed it could take months before the civilian government in Kabul fell -- allowing a period of time after American troops left before the full consequences of the withdrawal were laid bare.
          Now, officials are frankly acknowledging they are surprised by what's happened. "The fact of the matter is we've seen that that force has been unable to defend the country," Secretary of State Antony Blinken told CNN's Jake Tapper on "State of the Union," referring to Afghanistan's national security forces. "And that has happened more quickly than we anticipated." Read more here.

          What comes next

          The country is now facing the Taliban's return to power, which, if it's anything like it was in the 1990s, would mean a deterioration in civil liberties, particularly for women and girls whose freedoms grew under the civilian government.
          Terror groups could reconstitute soon. In a briefing for senators on Sunday morning, Chairman of the Joint Chiefs of Staff Gen. Mark Milley said terrorist groups like al Qaeda could reconstitute in Afghanistan sooner than the two years defense officials had previously estimated to Congress because of the recent, rapid Taliban takeover of the country, according to a Senate aide briefed on the comments.
          The situation could result in a rising counterterrorism threat, just as the 20th anniversary of the September 11, 2001, Al Qaeda attacks approaches.
          Additional US troops headed to Afghanistan. US Defense Secretary Lloyd Austin on Sunday approved 1,000 more US troops into Afghanistan, a defense official told CNN, for a total of 6,000 US troops who will be in country soon. Their primary mission is securing Kabul's airport.
          Next steps are still being debated. Discussions are underway among top White House advisers on how Biden should address the deepening crisis, officials said Sunday. No final decision has yet been reached about whether the President will return to Washington from Camp David, the presidential retreat where he was vacationing.
          UN Security Council to meet Monday. UN Secretary-General António Guterres is expected to brief the Council, with private consultations to follow.
            In remarks on Friday, Guterres called on the Taliban to halt their offensive in Afghanistan and didn't directly answer when asked what he would say to those who feel Afghanistan has been abandoned by the international community.
            Expect scrutiny from Congress. Already, some lawmakers are demanding more information from the administration on how its intelligence could have so badly misjudged the situation on the ground, or why more robust contingency plans for evacuating Americans and their allies weren't in place.