The Taliban are retaking Afghanistan. Here’s how the Islamist group rebuilt and what it wants.

After two decades of fighting in Afghanistan, the Taliban are on the verge of seizing power again for the first time since 2001.

The fundamentalist force that seeks to install Islamic law has blitzed across the country, overrunning one city after another and closing in on Kabul as the United States has withdrawn troops this summer. Few places outside the imperiled Afghan capital remain under the control of the Western-backed government, which is pleading for the international community to help fend off a complete takeover.

Hundreds of thousands of civilians are fleeing, setting off a humanitarian crisis that could ripple around the globe. Those who’ve stayed are reckoning with the return of extremist rule under the Taliban’s interpretation of Islam. Militants have shuttered girls’ schools, banned smartphones in some places and forced young men to join their ranks, they say.

What is the Taliban?

The Taliban first rose to power in Afghanistan in the 1990s, formed by guerrilla fighters who drove out Soviet forces in the previous decade with support from the CIA and Pakistani intelligence services. Most of their members are Pashtuns, the largest ethnic group in the country. The name means students in Pashto.

The founder, Mohammad Omar, a commander in the anti-Soviet resistance, launched the movement in 1994 to secure the southeastern city of Kandahar, which was plagued by crime and violence. The Taliban’s vision of justice helped them amass power. “At the time people really wanted law and order, and there was none,” said Kamran Bokhari of the Newlines Institute, a foreign policy think tank.

In the fall of 1996, the Taliban seized Kabul and declared the country an Islamic emirate. Taliban rule was brutal and repressive. Women had virtually no rights, were barred from education and forced to wear clothing that covered their entire body. Music and other forms of media were banned.

The Taliban’s ideology was similar to that of its counterpart al-Qaeda, though its interests were limited to ruling Afghanistan. In exchange for help fighting groups aligned with the nation’s government, Taliban leaders harbored Osama bin Laden and other al-Qaeda members involved in the Sept. 11, 2001 terrorist attacks. A U.S.-led coalition ousted the regime later that year.

In late July 2015, the Afghan government confirmed that Omar had died in April 2013 in Karachi, Pakistan.

How did the Taliban regain strength?

After being ousted, the Taliban scattered. Some leaders found sanctuary in Pakistan, where they began to fortify themselves with help from the Pakistani security establishment. In Afghanistan, the presence of U.S. forces helped provide the Taliban with an anti-colonialist rallying cry for recruits. So did corruption in the Afghan government.

“For two decades now, the Taliban movement has been slowly chipping away, village by village,” said Robert Crews, an expert on Afghanistan at Stanford University. “It’s a very sophisticated kind of ground game of grass-roots mobilization.”

Militants also replenished their ranks through a campaign of fear and violence. People who enlisted in police forces or the national army were assassinated. Public intellectuals, journalists, media figures and others who represent the young face of Afghanistan’s civil society were also targeted.

Afghan troops, their ranks dogged by incompetence and corruption, have withered in the face of the Taliban incursion.

“People are asking, ‘Do I want to die for an administration that has not sent my unit ammunition? We’ve not been paid in months, we’re out of food. Now the Americans are gone’,” Crews said. “It seems kind of hopeless.”

How is the Taliban funded and armed?

The Taliban gets its funding from a variety of sources. Some money comes from the opium trade and drug dealing, or other crime such as smuggling. The group taxes and extorts farms and other businesses. Militants are sometimes involved in kidnapping for ransom.

The group also gets donations from a wide array of benefactors who support its cause or view it as an useful asset, experts said.

“It’s not really the case that they need a whole lot of money to operate,” Bokhari said. “They don’t live in big houses. They don’t wear fancy clothes. The biggest expense is salary and weapons and training.”

Arms are easy to come by in a region awash in them. Some are donated, others purchased. Many are stolen.

“As the Afghanistan national army has folded,” Crews said, “one of the first moves the Taliban has made in moving into new territory is to go to a government headquarters, arrest or kill those figures, open the prisons, and then go to the government bases and seize the weapons.”

In some tribal areas, including in Pakistan, a “cottage industry” of foundries has sprung up where workers fashion assault-style rifles, according to Bokhari.

What is the Taliban’s goal?

The Taliban’s aim is simple, experts said: to take back what the group lost in the early 2000s.

“They want their Islamic emirate back in power,” Crews said. “They want their vision of Islamic law.”

He continued: “They don’t want a parliament. They don’t want electoral politics. They have an emir and they have a council of mullahs, and that’s the vision they see as best for Islam.”

There does not seem to be a single leader of the Taliban, but the group seems to have several main leaders.

Whether life under Taliban rule will be the same as it was in the 1990s remains unclear. There’s little doubt that the group wants to confine women to their homes, end mixed-gender education and bring back a society with Islamic law at the center.

But a civil society has burgeoned in the past two decades that didn’t exist before. Women have assumed public positions not just in Kabul but also in smaller cities. Cellphones and social media are common. Experts questioned whether the Taliban would be able to govern a population that has changed.

“There are lot of people who are better connected to the world through social media and say, ‘Hey, why can’t we have a life like that?’ " said Crews. “What will they do with a society that believes in pluralism and doesn’t believe in monopolization of power? To what extent will Taliban violence silence those voices?”