A Somali-Canadian aid worker and activist was shot dead on Wednesday in Mogadishu, a police official said, dealing a new blow to efforts by the Somali diaspora to return home and help rebuild the country after decades of war.

The death of the aid worker, Almaas Elman, was confirmed by Brig. Gen. Zakia Hussein, the deputy commissioner of the Somali Police Force, who said investigations into the killing were continuing.

It was not immediately clear who killed Ms. Elman or why, but General Hussein said Ms. Elman was hit by a bullet while inside a car at the Halane complex, a heavily fortified compound that flanks the international airport in Mogadishu and is populated by African Union troops and representatives from United Nations agencies and embassies.

Said Fadhaye, a freelance videographer in Mogadishu, the Somali capital, posted on Facebook that he was in the car with Ms. Elman when she died. Describing the events as an “attack,” Mr. Fadhaye said Ms. Elman had “died on my lap,” adding, “May God have mercy on her.”