Amid the coronavirus outbreak in Iran, thousands of people have crossed the border into Afghanistan, a country they once fled. Kiana Hayeri for The New York Times What they didn’t realize was that they could not escape the pandemic; instead, they brought it over the border with them. Kiana Hayeri for The New York Times Now the virus threatens to explode in a country with few resources to contain it. Kiana Hayeri for The New York Times

Afghanistan’s Next War What happens when the pandemic comes to a country in conflict?

One Wednesday in March, 11,627 people crossed the Iranian border into the Afghan province of Herat. A sea of young men formed outside an immigration center that could accommodate only 300 people at a time. Some carried backpacks, others large sacks overstuffed with their belongings. One carried a child’s bicycle, another a string instrument. One had just two blankets folded under his arm, another a canary in a cage. As the line slowly moved forward, some put down shawls to pray; others found rocks to rest on.

Most of the men were Afghans in their 20s. Their search for a better life in Iran had been abruptly thwarted by the corona­virus, returning them to a border that once took them days to cross in the other direction — squeezed into the beds of pickup trucks by smugglers who sped them through deserts at night, leaving some with bruises and others with broken body parts. The least fortunate were left in the desert to rot.

Now, as the men waited to be processed back into a war zone they had tried to escape, health care workers shouting through a megaphone instructed them in how to wash their hands. By the afternoon, the crowd grew impatient and started pushing and shoving to get into the offices where each person would be registered. The police, overwhelmed, responded with force, beating the returnees back into a line that wrapped around the building, zigzagged a couple of times and ended in a sprawling crowd.

Returnees waiting to register with the authorities at the Afghan border.

Afghanistan shares more than 500 miles of border with Iran, much of it in western Herat Province, now the center of the country’s corona­virus outbreak. For years, activity along the border has been a barometer of sorts, reflecting the state of Afghanistan as a whole. When the country gradually devolved into a narco state after the American-led coalition toppled the Taliban in 2001, eventually producing much of the world’s opium, drug shipments were smuggled across the western border. Even low-level officials and commanders would return to Kabul after brief postings in border towns to build so-called poppy palaces in the city.

Later, as the war reached a hopeless stalemate and the United States began drawing down its troops after a decade of fighting, a new desperation gripped the Afghan people. The stability and prosperity that was promised with the American invasion evaporated. Hundreds of thousands of people rushed to leave. Many settled in Iran as illegal laborers, making barely enough money to survive and living under the constant threat of arrest — but at least safe from bombs. Others continued onward as far as Europe.

In February, however, the cross-border current reversed direction. A surge of suspected corona­virus infections in Iran started sparking fears of a major outbreak. Soon, the number of returnees arriving at the Herat immigration center doubled, then tripled its typical average of about 2,500. From Jan. 1 to April 11, nearly 243,000 people crossed back into Afghanistan from Iran, according to the International Organization for Migration.

While waiting to be processed, returnees are instructed on how to properly wash their hands and are told to avoid touching their face. Kiana Hayeri for The New York Times

Amid the economic crisis, the demand for Afghan day laborers, who work for lower wages than Iranians, dried up. Even under normal circumstances, they couldn’t access health care without discrimination. Now they were hearing that the hospitals were overwhelmed. There were also rumors that the Iranian authorities were killing Afghans suspected of being infected with corona­virus.

So they came back to what was left of home: villages sometimes ripped apart by fighting between the Taliban and Afghan security forces, or simply impoverished because of a lack of government services — bringing the virus with them. The country’s first few cases were detected in people who crossed the border. But quickly, these were outnumbered by others who had never left Afghanistan.

“People don’t even want to say hello to us from 50 or 100 meters,” said Khaled Sayed­khili, who returned to his village in Parwan Province in March with 14 members of his family. “Yesterday, a relative ran from me as if I was a suicide bomber.”

The Sayedkhili family crossed the border from Iran on March 18. All together, 15 members of the family returned. Kiana Hayeri for The New York Times They took taxis from the border to the city of Herat, where they spent the night before crossing the country to their village in Parwan Province, just north of Kabul. Kiana Hayeri for The New York Times Friends and relatives visited them in their village after being apart for seven years. When asked about self-quarantining, they said it was in the hands of God if they got sick. Kiana Hayeri for The New York Times Some of the Sayedkhili children were born in Iran, and they are struggling to adjust to their new surroundings. They don’t understand that they may never return to the place they call home. Kiana Hayeri for The New York Times

Eight weeks after Afghanistan recorded its first Covid-19 case in Herat, the virus has spread to at least 30 of the country’s 34 provinces and killed 30 people, according to official government numbers. But these figures almost certainly understate the virus’s reach: Afghanistan does not have the capacity to conduct widespread testing, and it has averaged about 100 tests a day. (The Ministry of Health in Poland, a country with a similar population, said it is conducting 16,000 tests a day.) Although the government has recorded less than 1,000 cases across the country, local officials in most places are working under the assumption that the virus is deeply embedded in their constituencies. In late March, Ferozuddin Feroz, Afghanistan’s health minister, warned that unless stricter social-distancing measures were enforced, 16 million Afghans could be infected and 110,000 could die.

Provincial officials and health care workers, particularly in Herat Province, are preparing, with what little equipment and resources they have, not only for a situation when the death toll starts rising drastically but also for the economic ramifications of shuttered shops and closed government offices — outcomes that may tip a country already deeply impoverished, unstable and mired in conflict into a spiral from which it will not recover. “The war has been an economic blow,” said Abdul Qayum Rahimi, who was governor of Herat Province from January 2019 until the first week of April, “but trade continues despite fighting. The factories continue; life continues. The virus, it stops everything.”

Afghanistan isn’t the only country in conflict made vulnerable by conditions that preceded the pandemic. In northwestern Syria, where a million people have sought refuge from the country’s nine-year civil war, limited access to clean water for hand-washing means the virus has most likely swept through many displacement camps. Supplies are slow to arrive, and doctors estimate that more than 100,000 people could die. In Iraq, which borders Iran to the west, the government-imposed lockdown has ravaged the fragile economy — already depleted by plummeting oil prices and the country’s three-year battle against the Islamic State. In many ways, the Afghan experience is a microcosm of the virus’s reach into the most precarious parts of the developing world, where climate change, food shortages, violence and territorial disputes have created circumstances dangerously ideal for the rapid and uncontrollable spread of a disease. And in what could perhaps be an unprecedented moment in modern history, there may be no superpower left untouched that can afford to offer help.

Returnees stop at a transit center run by nongovernmental organizations in the city of Herat before traveling on to their home provinces. Employees spray the facility with disinfectant twice a day. Kiana Hayeri for The New York Times

The virus arrived in Afghanistan at a precarious moment, even by the standards of the country’s turbulent history. The government is negotiating the terms of a peace deal with the Taliban that has already begun the departure of the remaining American troops, even as the insurgent group continues to attack Afghan forces. Over two weeks in late March and early April, the Taliban carried out more than 500 attacks across nine provinces, which were also among the worst hit by the infection.

Adding to the chaos is a disputed presidential election. In February, Afghanistan’s election commission declared the incumbent, Ashraf Ghani, the winner of last September’s vote, but his victory was challenged by Abdullah Abdullah, Ghani’s longtime political rival. On the same day as Ghani’s inauguration, Abdullah also took the presidential oath of office. Last month, the men failed to come to a compromise, so the U.S. State Department announced that it would cut $1 billion in aid to the government, which relies on foreign funding for 75 percent of its public spending.

The virus now serves as a test of the Afghan government’s competence without the United States as its benefactor, which Ghani has recognized as an opportunity to demonstrate his administration’s ability to govern. But with a bureaucracy bogged down by political infighting, many of his efforts have come across as hollow and contradictory. (While his administration was calling off small gatherings to slow the spread of the virus, both he and Abdullah invited thousands of guests to their swearing-in ceremonies in tightly packed venues, more than two weeks after the first confirmed case.)

People arrive every day at a clinic in the city of Herat for a coronavirus test. Most are told to come back later because testing kits have run out. Kiana Hayeri for The New York Times

Ingrained long ago into the psyche of Afghanistan’s leaders was an over­reliance on the United States and its allies. The mission in the country has never had clear definitions of success or failure; the abundance of avoidable deaths among civilians and soldiers rarely brought consequences. Corrupt, complacent and dependent, that system now finds itself contending with a swift-moving infection at a time when its most relied-upon patrons are overwhelmed by the same pandemic and are finally growing weary of the mess they have perpetuated for nearly two decades.

Officials in Herat follow the news from the rest of the world; they can recite the latest death tolls in Italy, in Britain, in New York. The degree to which the corona­virus brought rich, technologically equipped Western powers to their knees left many of them in shock — a shock that has since been replaced by a fear of what the devastation will look like in a vastly less-prepared place like Afghanistan.

By the time Herat Province confirmed its first case of corona­virus on Feb. 22, thousands of people were entering the country at the border. Iranian officials were still claiming that the corona­virus would not be a problem for the country, and they were slow to contain the outbreak. Within two weeks, Iran’s hospitals were overwhelmed with sick patients. Less than 100 miles south of Tehran, satellite imaging showed mass graves newly dug for corona­virus victims. Home to roughly 80 million people, Iran became one of the world’s earliest and worst outbreaks.

Ghani’s administration, humiliated by the American aid cut, was eager to demonstrate Afghanistan’s ability to prevent the virus’s spread. “I don’t need W.H.O. to come show my nation how to wash their hands,” Amrullah Saleh, one of the country’s two vice presidents, said in a local-television interview. His sentiment echoed that of Ghani, who has long described the United Nations agencies as inefficient. Despite the Public Health Ministry’s dependence on non­governmental organizations for even the most basic services, Ghani asked the U.N. to take a back seat on corona­virus efforts. Saleh went on to call Afghanistan’s response to the virus “the role model of management in the third world.”

Cmdr. Hussain Ali Hashemi (center) and his police combat unit were called in to guard Shaidahe Hospital in the city of Herat after dozens of patients fled. The facility has also been attacked by the Taliban. Kiana Hayeri for The New York Times

But during a recent visit to the city of Herat, the capital of the province of the same name, which is home to 1.5 million people, local officials appeared to be managing very little. Many businesses were closed, but the streets were still jammed with people and cars. As one senior provincial official said, “We disrupted the economy but not the virus.” The official estimated that there were 150,000 day laborers in the city who weren’t working because of the lockdown and had no way to feed themselves or their families. People donated generously in the early days, but those donations slowed as the long-term economic impact on businesses became apparent.

Outside the main provincial hospital, which is situated in the center of the city, was a small clinic, where in early April doctors dressed in hazmat suits were seeing as many as 400 people a day who were trying to be tested. A loudspeaker repeated a simple message: Corona­virus is dangerous; wash your hands; keep your distance. Most people were turned away and told to come back later. “I was in contact with someone who turned out positive about two weeks ago,” said 27-year-old Faiz Mohamad. He was among the three dozen people gathered at the clinic in the first hour it opened on a recent Saturday. He said he had a headache that wouldn’t go away, and he was also coughing. “I have come here three times,” he said, “and they have told me there are no kits and I should check back.”

Spare bed frames in Shaidahe Hospital’s courtyard. They were collected from other hospitals in and around the city. Kiana Hayeri for The New York Times

The doctor in charge of collecting samples for the tests, Mohamad Shah Alo­kozai, kept apologizing. He said the clinic already had a backlog of 360 swabs. Testing had stopped for 48 hours, and Alo­kozai said that while the W.H.O. sent a small batch of kits on a United Nations flight, they would sustain the lab for only a few days. “There are no kits,” he told those showing up every day. “If I take your sample now, I would be misleading you.”

Misinformation has added another layer of complexity to the city’s corona­virus response. Early on, unproved remedies spread online; one claimed that drinking two cups of black tea would make you immune to the virus. Later, a widely circulated rumor held that if you died of the virus, the government would refuse to hand over your body to your family — or worse, would burn the corpse. People who were hospitalized started fleeing from health facilities. Shaidahe Hospital, a facility on the outskirts of the city dedicated to treating ­Covid-19 patients, brought in a police combat unit to guard the building after 38 people escaped in the first days it was open.

In early April, one patient there broke a window, climbed over the compound wall, clambered onto a waiting motorcycle and roared off into the warren of tents in a displacement camp across the street from the facility. A woman rushed out of the hospital to alert the small group of police guards. “Commander, sir, corona escaped!” she shouted. Eventually, the patient was returned after three officers chased him in an armored vehicle and a fourth officer on a motorcycle trailed him through the displacement camp and into a shop, where he tried to hide. They tackled him and took turns holding him down as they looked for handcuffs.

A displacement camp surrounds Shaidahe Hospital. Many residents are believed to be Taliban members who have tried to attack the facility. Kiana Hayeri for The New York Times

Inside the Shaidahe treatment center, which was a children’s hospital before the outbreak, many of the rooms’ walls were still covered in posters of newborn babies. The facility has 100 beds, with dozens more in reserve. Of the 68 patients at the center in early April, only 35 had tested positive. The rest, suspected of having the disease, sat around waiting — some as long as eight days — for their results. In the women’s ward, female patients were confined four to six to a room, a mix of confirmed cases and those who still didn’t have test results. They sipped tea and chatted from their beds, which were spaced about three feet apart. Dr. Asif Rah­mani, a hospital manager, said the women were put together at the request of their families, so they wouldn’t be lonely.

Rooming patients together risked spreading the disease, but hospital workers were not faring much better at guarding against their own infection. Kiana Hayeri for The New York Times They didn’t have any N95 masks. An X-ray technician making the rounds of the positive patients’ wards wore a simple surgical gown. Kiana Hayeri for The New York Times The hospital had about half a dozen ventilators, but none of them worked. The staff kept calling technicians to fix them, but they didn’t show up. Kiana Hayeri for The New York Times The government announced that if doctors die, their families would be compensated like the families of security forces. “We don’t want death payments,” one doctor said. “What we want is N95 masks and protective gear.” Kiana Hayeri for The New York Times

Though Ghani sent more than $5 million to Herat by mid-March for equipment and supplies, the provincial administration couldn’t tap into it because the procurement process required extensive documentation and approval from the central government — bureaucratic measures that took weeks to relax. Beds, protective gear, ventilators and medications are among the supplies that have now been ordered, but it’s unclear when hospitals will actually receive them. “A person might walk big, but we will only know their true strength when they face a challenge,” said Rafiq Shaheer, a university lecturer and civil-society activist in Herat who is helping with the corona­virus response. “We faced the test, and the system didn’t work.”

As for a newly erected hospital that the government had rushed to complete in 18 days, it was impressive, from the tile floors to the slick automated doors. It even had V.I.P. rooms. But a week after Ghani’s office declared that it was officially “delivered for use,” the rooms had neither equipment nor patients. Local officials said they were unaware of a plan for how to staff the hospital with doctors and nurses.

The government ordered a 100-bed hospital to be built as quickly as possible in the city of Herat. It was constructed in 18 days, but it is not yet furnished or staffed. Kiana Hayeri for The New York Times

The Taliban, who have refused a cease-fire that could help the government redirect resources toward corona­virus efforts, were quick to seize the opportunity offered by these official failures. In Nangarhar Province in eastern Afghanistan, local Taliban leaders gathered journalists, doctors and residents in a packed room of a clinic, with little space between those seated. There were some masks and gloves on the table. For the cameras, a medical worker, wearing a full protective suit, raised what looked like a thermometer gun to measure a person’s temperature. On closer examination, it was simply a prop, made of plastic and wood, wrapped in white tape.

In early April, Ghani removed Herat’s governor, Rahimi, without a clear reason and replaced him with his 33-year-old deputy national security adviser, Sayed Abdul Wahid Qatali. A former mayor, Qatali knew the city well. But when he arrived in Herat, he found a place ill ­equipped to handle any kind of widespread outbreak that health officials were predicting. In news conferences, his tone was desperate and his message clear: Herat lacked the resources to feed hundreds of thousands who faced hunger and poverty; the population wasn’t taking the threat of the virus seriously. He had no qualms about warning of what was most likely coming.

“I am telling you, clearly,” he said. “I am busy digging graves.”

Sabera (right) and her niece, Somaya, tested positive for Covid-19 and were treated at Shaidahe Hospital. Kiana Hayeri for The New York Times

Kiana Hayeri is an Iranian-Canadian photographer and a senior TED fellow. She is a regular contributor to The New York Times from Afghanistan, where she has been based since 2014. Mujib Mashal is The New York Times senior correspondent in Afghanistan. Before joining the paper, he wrote for The Atlantic, Harper’s and Time. This is his first story for the magazine.

Reporting was contributed by Asadullah Timory, Najim Rahim, Zabihullah Ghazi, Fatima Faizi and Fahim Abed.