– This well-ordered, baroque city went into a panic Friday when a gunman opened fire at a McDonald’s then made his way to a nearby mall and continued his attack.

Authorities declared a state of emergency and shut down public transportation in the middle of the rush-hour commute. Members of an elite counterterrorism squad fanned out across the city, and residents were ordered to stay indoors. At some places, pedestrians could be seen raising their hands in the air as they walked past police officers who had drawn their weapons.

Authorities said the attacker was an 18-year-old German-Iranian who shot himself after killing nine people and wounding at least 16 others.

Witnesses in the McDonald’s described a scene of chaos.

One told CNN that her young son saw a man loading a gun in a restroom inside the fast food outlet before he started shooting at diners.

“He was killing the children,” said the woman, who was not identified. There was blood everywhere, she said.

“We’d just sat down and started eating,” another woman in the restaurant told Germany’s Bayerische Rundfunk TV. “The workers bolted out; the children started crying and ran around in panic.”

Then the gunman ran into the street, witnesses said.

A video shared on social media showed a man dressed in black shooting at people outside the restaurant.

Hendrik A. said in a phone interview that he had been riding his bike toward the restaurant when he came upon the site of the attack.

“I was over at the shopping center waiting for the light to get to McDonald’s,” he said. “I didn’t even realize the chaos or the panic that was around me. I came to a stop light and then I first realized that things were not normal. There were three bodies lying on the ground. And my first thought was ‘OK, they’re just lying on the ground, nothing really happened.’ Two of them didn’t move, one did.”

Then, he heard gunfire erupt behind him — “five to eight shots,” he estimated — coming from inside the shopping center. People started to run, he said. “It was not insane panic like you would imagine, a stampede or anything, but people were a little uneasy.”

An employee inside the mall, who would give only her first name, Sabiha, said she saw a gunman open fire outside her clothing store. The assailant moved through the corridors before leaving the building, she told the Washington Post.

“I was lucky because he shot toward the other directions, not mine,” she said.

After the attack, panic started to turn to confusion.

In a parking lot at the Schwabing Hospital, Souleyman Daitzik paced back and forth near the entrance to the emergency department. His teenage daughter and son had gone to the shopping mall and gotten separated when the shooting began. Daitzik learned that his son, 17, was shot but did not know where he had been taken. Daitzik had gone to four hospitals in search of him.

“I don’t even know if my child is alive or dead,” he said, as his wife began weeping. Relatives had been sent photos on their phones showing the son lying in a pool of blood but shielded the parents from the images. The relatives also had a video showing Daitzik’s daughter, wearing a red T-shirt, running and screaming, having ducked the gunfire; a few minutes later, the daughter arrived at the hospital in an ambulance, traumatized but only injured.