Two soldiers were arrested in the shooting, but the motivations were not clear, including whether it was an accident. The Somali cabinet later fired the auditor general, Nor Farah Jimale, whose guards, according to the police, shot Mr. Siraji.
The death was a vivid reminder of the dangers facing even high-level officials in Somalia, an anarchic nation in the Horn of Africa where the United States is fighting a campaign against the Islamist militant group known as the Shabab. The country has been in varying states of chaos since the United States pulled out after the deaths of 18 soldiers in 1993.
On Twitter, Sagal Bihi, a member of Parliament, remembered Mr. Siraji as a “humble and patriotic,” and an example of the “struggle & hard work” that had helped to rebuild the country.
Born in 1986 in Afmadow, a town in the Middle Jubba region of Somalia, Mr. Siraji was raised at the Dadaab camp in Kenya — often described as the world’s largest refugee camp — where he lived for more than 20 years. He finished high school there, and he received a bachelor’s degree in computer science in Nairobi.
Two weeks ago, Mr. Siraji spoke at a TEDx event in Mogadishu, and he urged young people to help rebuild the country. “I asked myself: What can you do for your country,” he said of his own path.
Mr. Siraji “was a victim of the high security tensions that continue to plague the population of the capital city of Mogadishu,” the United States Mission to Somalia said in a statement. It added that he “represented the best of Somalia’s great potential.”
“He was a rising star in the Somali government,” the statement said, “and his death is a loss for the country as a whole.”
The statement said the United States would continue to work “to ensure that terrorism no longer creates an environment of fear in which such tragic acts occur.”