uqba ibn nafi, on his return from the victorious battle in the atlas mountains, was killed by the army of the christian king kusaila ambushing him near the town of thouda in 642. his corpse was buried in the current sidi okba and later the mosque was built on top of it for commemoration. it is not exactly recorded who built the mosque. historians consider that it was the followers of uqba who were captured during the battle, and later redeemed by the judges in tunis from the prison. commander zuhayr ibn qays sent them back along with other muslims to thouda, where they built the mosque.