The insurgent fighters who routed the Iraqi army out of Mosul on Tuesday did not just capture much of Iraq’s second-largest city. They also gained a windfall of arms, munitions and equipment abandoned by the soldiers as they fled — arms that were supplied by the United States and intended to give the troops an edge over the insurgents.

The problem is not a new one, but it looms larger now that the United States is shifting its counterterrorism strategy away from using American armed forces directly, and toward relying on allied or indigenous troops and security forces supplied and trained by the United States. President Obama proposed last week that a $5 billion fund be set up to finance such efforts.

But those proxy forces do not always prove equal to the task, and when they buckle, the United States finds itself having unwittingly armed its enemies — a problem the Obama administration has been trying to avoid in Syria by carefully limiting its aid to the opposition there. The militants who swept into control of Mosul on Tuesday are believed to be connected to the main Islamist militant group fighting in Syria.