The Moroccan team claimed an impressive 63-32 victory to top the podium at the Tongaat Indoor Sports Centre.
The result earned Morocco a berth at next year’s World Championships, due to be held in Hamburg in Germany.
Rida Maatoui spearheaded the Moroccan charge as he racked up 24 points, 18 rebounds and five assists in a dominant performance from his team.
Algeria, who had come into the final with an unbeaten record having won their previous seven matches, were led by Nabil Guedon.
Guedon managed a personal haul of 11 points, eight rebounds and four assists but it was not enough to send his side to the World Championships.
Egypt beat hosts South Africa 53-50 to seal the bronze medal.
South Africa were also denied success in the women’s final as they were beaten 53-25 by a rampant Algerian side.
Algeria will join Morocco’s men at the World Championships in the German city.
They came through against hosts South Africa.
Zimbabwe were the recipients of the bronze medal as they recorded a comfortable 29-6 victory over Kenya on the final day of the event in the South African city.