The Afghan police and army are praised for fending off coordinated assaults, apparently by Haqqani militants, but the 18-hour battle also exposes intelligence failings and other shortcomings.

Afghan as well as Western officials said insurgents were aware how easy it was to blend in with the crush of daily traffic in and out of the city. Mohammadi, the interior minister, said some of the attackers disguised themselves with burkas, the all-enveloping veils worn by many women, and used ordinary vehicles to transport their weapons.

The broadside against the North Atlantic Treaty Organization took American officials by surprise, coming on the heels of laudatory statements about the Afghan personnel from U.S. Ambassador Ryan Crocker and the American commander of Western forces in Afghanistan, Gen. John R. Allen.

American officials in Afghanistan declined to comment specifically on Karzai's criticism, but one military official, speaking on condition of anonymity, said tracking the movement of insurgent fighters and weapons into the city was a task that would have mainly come under the purview of Afghanistan's main intelligence agency.

In Washington, Defense Secretary Leon E. Panetta said at a Pentagon news conference, "We had received a great deal of intelligence indicating the Haqqanis were planning these kind of attacks." But Army Gen. Martin Dempsey, chairman of the Joint Chiefs of Staff, added that the information was not specific about when or where the attacks would occur.

"The Taliban wanted to make a statement they were back," said Dempsey. It was a "big challenge," he added, to prevent attacks when the intelligence is "vague and you have to keep your guard up constantly."

In keeping with their emphasis on the Afghans' ability to fight alone, U.S. officials — who said American rapid-reaction forces had been ready to provide assistance if necessary — played down the role of coalition air power in the final stages of subduing what had been a team of dozens of insurgent attackers. Early Monday, Black Hawk helicopters hovered near the high-rise buildings where the last of the assailants were holed up, firing machine guns and illumination flares as Afghan police and soldiers advanced floor by floor.

With all eyes on the capital during the attacks and their aftermath, there was relatively little notice of an incident Monday that pointed to another major ongoing difficulty as Americans intensify their efforts to train and equip Afghan forces: "insider" attacks. Shootings by members of the Afghan police and army have accounted this year for nearly one-sixth of the coalition's fatalities.

In Kandahar province, a spokesman for the provincial government, Ahmad Javed Faisal, said an Afghan soldier had opened fire Monday on a vehicle carrying NATO troops, but missed his target. The NATO troops then shot and killed the assailant, he said.