When most American troops departed Afghanistan in 2014 and the Obama administration helped install a unity government, it was supposed to set the country on a path toward self-sustainability after two decades of Taliban rule and foreign military intervention.
Instead, Afghans are escaping their country in some of the greatest numbers since the 2001 U.S.-led invasion.
The loss of money and hundreds of thousands of jobs connected to the U.S. military presence has brought Afghanistan's economy to a halt and laid bare the weaknesses of the Afghan state. It also has galvanized Taliban insurgents, who briefly took over the northern city of Kunduz in the fall and have made gains in the southern province of Helmand against overstretched government forces.
The combination of unending violence and lack of economic opportunity has driven many Afghans to flee.
Afghans accounted for one-quarter of the more than 1 million refugees and migrants who arrived in Europe in 2015, the second-largest group after Syrians fleeing their country's civil war, according to the United Nations refugee agency. The exodus has continued even after the European Union decided last month to classify Afghans as economic migrants, significantly reducing their chances of gaining asylum.
Herat, an ancient trading city 75 miles from the Iranian border, has become a hub for Afghans beginning the risky journey along the migrant trail north to Europe.
Travel agencies offer to procure passports and visas for hundreds of dollars apiece. For those unable to pay for documents — or unwilling to wait — smuggling networks promise to deliver a traveler across the Iranian border for less than $1,000.
Every night, small bands of travelers carrying little more than cheap cellphones and a change of clothes set off from the city's outskirts and begin the weeklong trek across the sparse desert to a southern border crossing where there is less chance of detection by Iranian border guards.
Any day now, Mohammad Aref and his family are likely to join the growing human caravan.
As a security guard for a foreign company during the Afghan war, Aref's father saved enough money to build a house at the edge of this western city — an insurance policy, he told his son, against their country's unsettled future.
This month, Aref, a jobless 23-year-old university graduate, sold the house for less than $30,000, half what it cost to build, to raise money to pay smugglers to guide him, his mother and two sisters into Iran.
"Imagine if you were a bird building a nest, and then someone comes along and takes the nest away. That's how it felt to give up our house," said Aref, fighting back tears.
"But that's the position we are in. Right now, we see no future in this country."
Aref, who graduated from Herat University with a degree in international relations, spent a year searching in vain for work. Of 16 men in his class, he said, half had left Afghanistan or were preparing to do so.
His father had already escaped to Iran after receiving threats for working for a foreign company. His younger brother was camped out near a harbor in Turkey, waiting for smugglers to ferry him across the sea into Greece.
Aref had remained behind to look after his mother and two sisters. But conservative Islamists, including some relatives, began harassing him for attending the university and denounced his mother, a poet who opposed hard-line teachings.
"They think we're unholy because we are educated," said Aref, who has deep-set eyes and a crooked nose. "Meanwhile, we hear day by day that the Taliban are growing stronger."
Although Herat province has avoided the worst violence of the war, Taliban extremists and their allies remain entrenched in rural areas. A Taliban ambush in the summer killed 11 soldiers in the family's home district of Karokh, 30 miles from the provincial capital.
Within days, the Arefs put their house on the market. Aref's mother visited a local passport office but found such a crowd that she turned around and came home.
Near-daily reports of Taliban attacks have sparked a profound crisis of confidence, particularly among the young, educated Afghans whom the government was relying on to help rebuild the country. Among 1,711 newly arrived Afghans surveyed recently in Southern Europe by the International Organization for Migration, the average age was 24, and one-fifth had received a college education.
"People need to feed their families, and if they see migration as their only choice, that's what they will do," said Abdullah Ahmadzai, the Asia Foundation's country representative in Kabul, the Afghan capital. In an annual survey the group conducted last year, 40% of Afghans said they would leave the country if they had the chance — the highest figure since it began posing the question in 2011.
On Afghan social networks, the usual patter about soccer and politics is now accompanied by discussions of visas, smugglers and European border policies. In cities, houses are going up for sale at bargain prices while secondhand dealers snap up furniture, dishware and other goods hastily discarded by families trying to raise funds.
Mohammad Azim, a 26-year-old university graduate with broad shoulders and a sweep of dark hair, decided recently to set off for Iran on his own, hoping to send for his wife and baby daughter once he reached Europe. He had raised one-third of the roughly $500 the smuggler was demanding and was counting on relatives to sell some of their farmland in central Afghanistan's Daikundi province to supply the rest.
Like many members of the Hazara ethnic minority, Azim said, he faced discrimination in government jobs. With a degree in political science and experience working for a German contractor that was training Afghan police officers, he had applied to dozens of positions in the last two years but received no responses.
Classmates who had reached Germany told him about opportunities there.
"I had high hopes 10 years ago, but the atmosphere in Afghanistan now is hopeless," Azim said. "The only ones who get jobs in Afghanistan have connections. If I get out of this country, I won't have to knock on 1,000 doors for a piece of bread."
Azim's job with the German company ended in 2014 with the drawdown of U.S.-led international forces, which at its height numbered more than 130,000 and is now down to one-tenth that size. The withdrawal not only placed responsibility for Afghanistan's security almost entirely in the hands of government soldiers and police, but it also eliminated, by one estimate, 500,000 jobs connected to foreign military bases.
Afghanistan's economic growth slowed to 1.3% last year from an annual average of nearly 7% in previous years, according to the World Bank. A unity government brokered by Secretary of State John F. Kerry to resolve the disputed 2014 presidential election had to contend immediately with an economic transition for which U.S. and Afghan officials acknowledge there was inadequate planning.
"The government inherited a very bad problem," said Javid Faisal, a spokesman for Abdullah Abdullah, the election runner-up who now serves as chief executive in President Ashraf Ghani's government.
American officials worry privately about the fate of the $32 billion the United States has spent on governance and development programs in Afghanistan since 2001. To stem the brain drain, the Afghan government has launched a social media campaign to persuade people not to leave, including pictures showing overcrowded rescue boats at sea to remind would-be migrants of the risk of drowning in the Mediterranean Sea.
"It's not only the government's duty to make the country a better place," Faisal said. "If we call ourselves Afghans we should stay and try to make a difference."
But many have given up. Firoz, a 35-year-old dental assistant and television station employee, began to consider packing up in November after four children were kidnapped on the way to the private school his 10-year-old son attends in Herat, part of a wave of abductions linked to criminal gangs.
He and his wife decided to take their son, Suroosh, out of school. But a few weeks later, the private TV station where he works received threats from militants who were unhappy with its programming.
On a gray morning early this month, Firoz, who asked that his full name be withheld because of the threats, sat in a friend's living room and rattled off everything he had given up. Firoz and his wife took out a loan on their house, sold his Toyota sedan and hawked their china.
They had raised more $60,000. Any day now, he said, a smuggler would call and tell them to get ready to leave.
"When the Americans entered Afghanistan, we thought things would be good — and for a few years they were," Firoz said. "But more and more, we feel like we are on our own. The police here can't be trusted. The judiciary can't be trusted. How can you have a life like that?"