Somalia's president says military forces have made inroads in their fight against al-Shabab militants but the key to defeating them lies in providing better opportunities for the country's youth.

President Hassan Sheikh Mohamud on Sunday told a gathering of top defense officials and diplomats that 70 percent of his country's population is under 35 and have grown up in the chaos of a lawless state after the government collapsed in 1991.

He says that's left them "very, very vulnerable to be recruited by the evil forces" like al-Qaida-linked al-Shabab.

Mohamud says many of those fighting for al-Shabab "are not there for ideological reasons, they are there for economic reasons ... to feed their families."

Somalia faces regular al-Shabab attacks even after driving them from the capital, Mogadishu, in 2011.