PAGHMAN, Afghanistan — As U.S. soldiers rolled onto the scene at one of the “gates of Kabul,” it quickly became clear that the situation was complicated.

Members of the Army’s new 1st Security Force Assistance Brigade had traveled by mine-resistant vehicle to meet with Afghan forces on the southwestern outskirts of the country’s capital. In the face of repeated attacks, Afghan officials last year installed a hulking, door-frame-shaped scanner to search for bombs in passing trucks. But U.S. soldiers arrived to find the scanner broken and a line of frustrated truckers waiting with dozens of vehicles.

Lt. Col. Zachary Miller, the senior U.S. officer on the scene, thanked a couple of the drivers for their patience. One of them expressed irritation with his hours-long wait and told Miller that drivers are sometimes able to skip the screening line by paying a bribe of 1,000 Afghani — about $14 — to Afghan forces. And aside from the human dynamic, U.S. soldiers also question how effective the scanners really are.

The June 2 mission in southwestern Kabul province is illustrative of the lasting problems of Afghan corruption and ineffectiveness, both in personnel and technology, that have hampered the war effort for years. Progress, where it exists, often comes in fits and starts. The brigade is attempting to advise the Afghans on handling these perennial problems while also establishing a new kind of unit — more extensively trained to coach and mentor local forces — that the service plans to use in other conflict zones.

“The idea is to deter or filter out as much of this stuff as possible before it gets into the city,” Miller said of the bomb-prevention mission. “Once stuff is in any large city, it’s very, very difficult to track it down.”

That assessment comes more than three months after the security assistance brigade, known by the acronym SFAB, deployed this spring as part of the new strategy for Afghanistan that President Trump announced last summer. It focuses heavily on putting military pressure on the Taliban in the hopes that the militants will be forced to negotiate a peace settlement with the Afghan government. The plan added a few thousand U.S. troops that pushed the overall number deployed to more than 15,000.

The brigade deployed with about 800 military advisers and a few hundred additional soldiers from the 3rd Infantry Division for security. It fanned out across the country to focus on everything from improving logistics to helping plan Afghan military operations.

But the role of Miller’s unit quickly changed. He and his staff were originally sent to Kandahar province but were redeployed to Kabul within a few weeks to help stop bombings. Other SFAB soldiers in different parts of Afghanistan joined him. 

The result is Task Force 5, a part of the brigade that has U.S. soldiers deployed in both the center and outskirts of Kabul. They advise and assist the Afghan ­National Army and an Afghan National Police unit that was established within the last year to provide security in areas around some of Afghanistan’s most significant targets, including ministries’ headquarters, the presidential palace and areas around diplomatic facilities.

Army Gen. John W. Nicholson Jr., the top U.S. commander in Afghanistan, in March designated preventing massive bombings in Kabul as the new top priority of the U.S.-led military coalition, following a spate of high-profile explosions that killed hundreds of people. He said then that in addition to more advising, the coalition also would provide ­intelligence to better map out insurgent networks in Kabul and ­Special Operations raids to root out enemy safe houses.

The Washington Post joined Miller’s task force for two days last month in the brigade’s first media embed since deploying. At the task force’s request, The Post agreed to withhold several details about the bombing prevention effort to protect operational security, including the exact number and location of other scanners and upgrades to security that are planned in coming months.

The Afghan government began bolstering security for Kabul at the direction of President Ashraf Ghani after a May 31, 2017, bombing in which a vacuum tanker truck packed with explosives detonated near the German Embassy, killing at least 150 people and injuring about 500 more. 

The Afghan efforts included installing the scanners to prevent explosives from rolling into the city and adding additional security checkpoints in the heart of the city. The scanners are placed at the city’s “gates” — checkpoint-like areas on an estimated 100-mile perimeter around the city. Height-restriction barriers were added inside the city to prevent the free flow of trucks like the one used in the embassy bombing.

The gates themselves were once manned by Afghan police, but the job was transferred to the Afghan army — the more respected institution — within the past year. The task is daunting: About 100,000 vehicles pass through the city’s gates each day in a region that has seen its population mushroom from about 500,000 in 2001 to about 5 million today, U.S. military officials said.

“When you’re talking about a large line of vehicles that they’re trying to work through, we’re trying to make sure that they’re doing their due diligence,” said Capt. Dare O’Ravitz, the leader of one of the adviser teams.

O’Ravitz’s team visited a small, dusty outpost after leaving the scanner at the so-called “Arghandi Gate” on June 2. The Afghan soldiers there had responded the previous week to a Taliban attack on their base by launching patrols to see what they could learn. 

But the mission was limited because the fighters launched the attack from over the border in neighboring Wardak province, and the Afghan soldiers said they did not feel able to communicate directly with the Afghan army unit based there. The situation underscores that communication and cooperation between separate Afghan units fighting the same enemy is still lacking.

The Afghan soldiers also requested upgrades to their base that had long been promised by senior Afghan defense officials. Construction machinery sat unused nearby without needed fuel. The Americans said they could not provide it — but they would put in a word to see if they could jump-start the process in the ­Afghan government.

“I have the papers that the chief of general staff signed for this base,” Miller said of the plans. “But now that I’ve been out here and seen it, we will see if we can make progress on getting the rest of the materials and the fuel.”