London(Araweelo News Network)Taxpayers’ money will also go to fund mobile criminal courts in lawless states currently plagued by al-Qaeda.
The prison in Mogadishu will ensure dangerous warlords are kept behind bars.
It will also make it easier for Britain to deport foreign criminals and terror suspects.
More than 400 Somali criminals are in UK jails because there is nowhere to detain them back home in Africa.
International Development Secretary Justine Greening is splashing out to rebuild the Somali capital’s 180-year-old prison, which will hold 700.
But she risks a row about Britain’s overseas aid spending as it is protected from cuts.
Somalia — scene of Hollywood movie Black Hawk Down — is fighting al-Qaeda terror groups and pirates who prey on UK ships and tourists.
Ms Greening said: “By building jail places and courts in Somalia we can help our African allies challenge terror and crime on their own doorstep so less ends up on ours.”