MOGADISHU, Somalia — When the first explosion rang out, the men on the hotel patio looked up for a moment, then at one another — and kept on eating breakfast. Mogadishu, the capital of Somalia, long ago grew accustomed to such jarring sounds, and nobody seemed surprised by a loud bang somewhere not too far away.

It took another, even louder explosion a few minutes later to get everyone’s attention. Something fatal was going on.

A half-dozen of the militiamen who guard the hotel piled into a pickup with their Kalashnikovs and ammunition vests while the photographer Tyler Hicks and I grabbed our gear — cameras, notebooks, bulletproof vests, press credentials, bottles of water — and climbed into an armored truck, slamming the door tight behind us. We headed for the hospital.

I have been to Mogadishu many times, but this was my first visit in several years, and when I got to town, I was struck by how much progress the capital seemed to be making. There was still plenty of evidence of the chaos-racked city of old — the crushed houses, craters and shot-up walls — but there were also new apartment complexes, crowded markets and freshly painted shops selling flat-screen TVs. It was even possible to go out for pizza Tuesday night, something I would never have dared before.