But at some point, Hanafi turned his interest from journalism to terrorism -- and joined Al-Shabaab
He used his media connections to spy on and betray fellow journalists, identifying reporters with negative opinions of Al-Shabaab and facilitating assassinations. He even carried out assassinations himself, a military court ruled.
Hanafi was convicted of murder and sentenced to death. On Monday, shortly before a firing squad executed him, Hanafi released a statement saying he wanted to die as a martyr.
"Today, I'm being killed in the way I chose, which was to die for the sake of Allah," he said. "I don't fear execution."
From reporter to militant commander
Hassan Hanafi Hajji Abdi, 36, worked for Holy Quran Radio as a reporter and presenter from 2003 to 2005 before joining Al-Shabaab in late 2006.
Four years later, Al-Shabaab overtook Holy Quran Radio
in 2010, allegedly spreading propaganda over the airwaves.
The next year, in 2011, Somali troops and those from the African Union Mission in Somalia forced Al-Shabaab out of Mogadishu.
As it turned out, Hanafi wasn't just a media officer for Al-Shabaab; he was also a senior commander in the battlefields against Somali and AU troops.
He was actually promoted to midlevel militant commander by Ahmed Godane
, the now deceased leader of Al-Shabaab. Hanafi was critically injured fighting Somali and AMISOM troops in 2010.
Four years later, Hanafi suffered blast wounds to his head and fled to Kenya, seeking treatment under a fake name. But he was captured and extradited to Somalia.
Plotting to kill journalists
During his time with Al-Shabaab, Hanafi helped the Al Qaeda-linked terror group kill reporters in south and central Somalia.
Hanafi admitted to killing Sheikh Nur Abkey, an editor at Somali National News Agency. He also confessed to facilitating the deaths of four other journalists, but he denied actually murdering them.
"I personally killed one journalist, and that was Sheikh Nur Abkey, while the four others were murdered by my fellow Al-Shabaab fighters," Hanafi said during his court hearing. "But I contributed to the all assassinations."
But a military court found him guilty for his role in the deaths of the other four journalists: Mahad Ahmed Elmi, Ali Iiman Sharmaake, Said Tahliil Ahmed and Muktar Mohamed Hirabe.