He had planned to stay only a few months, but put off leaving. “I had to stay,” he said. “It was getting worse: more injuries, more doctors leaving.” Crossing back into Turkey along smuggling routes also became dangerous. “I was procrastinating,” he said. “I am not a very risky person.”

But as the Syrian government closed its grip on the city, Aleppo became one of the most dangerous war zones on Earth, and hospitals and medical clinics became frequent targets of government bombs. He lived and worked in three field hospitals, operating underground for two years.

The medical staff learned the rhythm of the bombing — jets and helicopters began at 9 a.m. and eased off at nightfall — and would venture upstairs for an hour to eat, before shelling from nearby government posts sent them back underground.

For a few months there was a cease-fire and he found respite visiting Syrian friends in the countryside outside Aleppo. He even got engaged, after a friend introduced him to Joud, a 23-year-old social worker who worked in the administration of a charity.

As the bombing intensified, casualties rose. A month after their engagement in 2016, Joud was killed in a bombing on her way home from work. Dr. Ibrahim withdrew into himself for a few days in grief and anger. “I did not feel like talking to anyone.” Soon, though, he returned to work. “Other people lost more than me,” he said.

The hospital was swamped by the wounded in the last months of the siege. “I could not go out of the hospital for a few minutes, because any second a shell might fall on us,” he said. “I was someone else. Not sleeping. Not walking. Like you are in a prison and working in a prison.”