“This will end tonight,” Kenyan officials had declared as a major rescue operation got under way on Sunday evening. But shortly thereafter, three Kenyan commandos were shot dead at close range and several hostages were killed as Kenyan forces tried to move in on militants hiding in a dark corner of the mall, Western officials said.

When The Standard, one of Kenya’s biggest newspapers, hit the stands on Monday with the headline, “The Final Assault,” the sound of gunfire and explosives was still echoing through central Nairobi, spreading even more fear among Kenyans, who have been shocked and demoralized by the events over the past three days. A cone of black smoke rising from the roof of the mall could be seen like a signal fire from all around the city.

Kenya is a crucial American partner, whose security forces work closely with their Western counterparts to contain Islamist militants in the region. Now Kenya’s capital, considered an oasis of prosperity in this part of Africa and an important base for Western embassies and businesses, has become a battleground in the conflict, and there is growing concern that this attack will not be the last.

Several witnesses said that some of the ringleaders of the assault — in which masked gunmen moved methodically through the crowded mall on Saturday, killing men, women and children — may have escaped during the initial confusion. One witness said that an assailant quickly tore off his clothes and changed into a new outfit before running out, hands raised, blending in with a crowd of fleeing civilians.

Security officials in Nairobi said that two other militants — both women who appeared to be directing other assailants during the killings — also managed to escape after the initial stage of the attack, raising fears that well-trained terrorists could be on the loose in Nairobi. Several witnesses have said that some of the militants were clearly not African and may have been from Western countries.

Kenya’s security forces have a reputation for being lowly paid and underequipped, and they seem to have been ill-prepared for a complex hostage situation against die-hard militants like this. According to several Western officials, the Kenyans initially rebuffed offers of assistance from the American government and turned instead to the Israelis, who dispatched advisers from the Israeli Defense Forces. Those advisers have been working closely with the Kenyan commandos inside the mall, helping plan specific tactical operations, though officials said the Israeli advisers had not engaged in any combat and had stayed out of public view.

The American, French and British officials have been left with a more back-seat role from a command center just down the street from the Westgate mall, helping the Kenyans with the investigation of the attack and some intelligence matters, a high-ranking Kenyan official said Monday.

“There’s too much consultation going on,” said the Kenyan official, who had not been authorized to speak publicly. “This should have been a small rescue operation, not preparing for war.”

On Monday afternoon, Kenyan security officials acknowledged that the effort to end the standoff had taken longer than expected, though they offered a different account of their setbacks, saying that about 10 Kenyan soldiers had been injured but none killed.