The gunmen arrived soon after sunrise, surrounding Hawa Abdi’s hospital one day in 2010. Marching through the hallways of one of southern Somalia’s few medical centers, they shot anesthesia machines, tore up records, smashed windows and destroyed the country’s few glass incubators. In panic, mothers ripped IV tubes from their babies and rushed into the bush.

The 750 militants, many of them teenagers, were members of Hizbul Islam, a radical Islamist group known for stoning offenders or chopping off hands. They had arrived with automatic rifles and a question for Abdi, a gynecologist known for turning her family’s farm on the outskirts of Mogadishu, the Somali capital, into a haven for Somalis fleeing famine, poverty and an ongoing civil war.

“Why are you running this hospital?” they demanded, according to a New York Times report. “You are old. And you are a woman!”

Abdi, then 62, was unfazed. She had been forced to marry an older man at age 12 and went on to become one of her country’s few female physicians, opening a one-room clinic in 1983 to help women giving birth in the East African countryside.

Eight years later she began radically expanding her efforts, spurred by the onset of civil war, to treat anyone who visited her office, whether for malaria or malnutrition.

Thousands soon arrived, and the clinic grew into a 400-bed hospital. The surrounding farm transformed into a makeshift city, Hawa Abdi Village, ultimately home to an estimated 90,000 displaced Somalis living in huts made from sticks and plastic sheets. Under Mama Hawa, as Abdi was known, they received free medical care, food and education at an 800-student school.

When the militants put her under house arrest, hundreds of women living in the complex protested in a show of support. Somalis across the country condemned the attack. The insurgents retreated after a few days and, at Abdi’s insistence, wrote an apology note.

“I told the gunmen, ‘I’m not leaving my hospital,’ ” she said in a 2011 interview with The Times. “I told them, ‘If I die, I will die with my people and my dignity.’ I yelled at them, ‘You are young and you are a man, but what have you done for your society?’ ”

Abdi, who returned to work after replacing the militants’ black flag with a white sheet from her hospital, was 73 when she died Aug. 5 at home in Mogadishu. She had several strokes in recent years, said her daughter Deqo Mohamed, but the precise cause of death was not known.

“She had a really deep faith and sense of hope that things could change in Somalia,” said journalist Sarah Robbins, who co-wrote Abdi’s 2013 memoir, “Keeping Hope Alive.” In a phone interview, Robbins recalled that while touring the United States to promote the book, Abdi urged young Somali Americans to help rebuild their ancestral home.

“This was a beautiful place,” Abdi said, telling stories of Somali life after the country became independent in 1960. “This can be a beautiful place again.”

Abdi was part physician, part human rights activist, with a law degree she earned on the side to protect herself from men who sought to take advantage of a woman running her own nonprofit organization without a husband, brother or son by her side.

“My mom would not talk much. She would just say a couple words and do the work,” Mohamed said by phone from Mogadishu, where she and her younger sister now run the Hawa Abdi Foundation with support from aid organizations. “She often repeated a Russian saying: The beauty of a city is the statues or the streets. But the beauty of a human being is his work. If you want to be beautiful, do the work.”

That work was recognized around the world as early as 1993, when President George H.W. Bush visited Mogadishu on New Year’s Day. Abdi was the first Somali he met; she guided him across her hospital grounds and through the camp of displaced families at a time when it was known as Lafoole, meaning “place of bones.”

“It’s just very, very emotional for me to see it,” Bush told reporters after visiting the compound. “And I’ll tell you,” he added, “I’ve got great respect for what they are doing.”

Abdi was later hailed as “equal parts Mother Teresa and Rambo” by Glamour magazine, which named her and her daughters Women of the Year in 2010. Two years later, actress and humanitarian Angelina Jolie delivered a testimonial on her behalf at the Women in the World summit in New York City. Abdi was unable to attend and sent a message to the audience.

“I have given my people my heart and my soul,” she said. “Still I did not lose my hope. One day my people’s lives will change in a better way. I hope my children and the children who grow in camp, and are born in the hospital, will change the lives of Somali people.”

Hawa Abdi Dhiblawe was born in Mogadishu in the spring of 1947. Without knowing her precise birthday, she adopted the May 28 birth date of her daughter Mohamed. Her father worked at the city port in an era when Mogadishu was controlled by Britain and then Italy; her mother died of childbirth complications when she was 12.

The episode introduced her to the shortcomings of the country’s health-care system and set her on a path to become a doctor. “I wanted to help future generations and children to avoid the pain I felt,” she later told an interviewer. It also led the family to give Abdi up for marriage, according to Mohamed.

The marriage ended in divorce after the death of her infant daughter, which she attributed to a female genital cutting ritual she had undergone as a child, and that apparently compromised the birth. After the child died, she returned to school and received a scholarship to study gynecology in Kyiv, in what is now Ukraine, as a result of Somalia’s Cold War-era alliance with the Soviet Union.

Abdi returned to Mogadishu in 1971, at a time when Somalia had about 60 doctors, according to her memoir. She worked at Digfer Hospital, where most of her colleagues were Italian and only one was female, before starting her own clinic at her family farm.

Its location, on the road between Mogadishu and the town of Afgooye, made it a destination for families in need. By 2010, the corridor was home to more than 400,000 displaced people – more than anywhere else in the world, according to the United Nations High Commissioner for Refugees – and the camp had grown to about 90,000 people.

Abdi initially sold a stockpile of gold to feed the women and children who flocked to her doorstep. “Then, as the famine worsened, she had to pay gravediggers in food to bury the more than ten thousand who died,” journalist Eliza Griswold wrote in her 2010 book “The Tenth Parallel.”

In interviews with visiting reporters, Abdi often said she had not intended to support thousands of displaced families. But “necessity is the mother of invention,” she explained.

To keep the peace, she instituted certain rules. Husbands who beat their wives were sent to a makeshift jail, a storeroom with barred windows. Newcomers who sought to maintain the clan identifications that had torn the country apart were not allowed to stay.

“When they come, we were informing them, if you use the clan division, or you said I am that clan, you cannot stay here,” she told NPR in 2013. “You will be Somali. And you will see, we will welcome you.”

Abdi married Aden Mohamed, a military technician, in 1973. They later separated, and he died in 2012. Survivors include her two daughters, Deqo and Amina Mohamed, both physicians; two sisters; and three grandchildren. A son, Ahmed, was killed in a 2005 car crash exactly 15 years before Abdi died, according to Deqo Mohamed.

About three years ago, Abdi stopped working regularly at her hospital, which has since closed – temporarily, the family hopes – because of safety concerns. “We’re hoping when things clear out, we can regain her legacy,” Deqo Mohamed said. She added that fewer than 10,000 displaced Somalis remain in the camp, where the school has continued holding classes.

Most of the camp’s residents have been women and children. “The men are dead, fighting, or have left Somalia to find work,” Abdi told Glamour, adding that the country’s women were more than capable of carrying on without them.

“Women can build stability,” she said. “We can make peace.”

Comments are not available on this story.