UN chief Ban Ki-moon met with Somali President Hassan Sheikh Mohamud under heavy security Wednesday in Mogadishu, his first visit to the dangerous capital of the war-torn nation for almost three years.