Tunis was the traditional capital of Tunisia.
1230, the Berber Hafsids came to power in Tunis.
In 1270 (as OTL), the French started the Seventh Crusade against Tunis (Palestine was planned, but Charles of Anjou thought Tunis was better - it was certainly closer to his new lands in Sicily), which ended in a defeat and king Louis IX's death.
1347-57, Tunis was under the rule of Morocco. In the 15th century, it came under Seljuk influence, as did the other Barbary states.
1565, in the Peace of Ostia following the second Occidental-Seljuk War, the Rum-Seljuks gave up Tunis and Sicily to the Triple Monarchy of England-Castille-Portugal. After the Great Seljuk War, all of Tunisia followed in the peace of Naples 1604.
After the Triple Monarchy of England-Castille-Portugal fell apart, Tunis changed hands again: 1629, the disgraced commander of the Mediterranean fleet, a duke Francisco of Álvarez, went to Sicily, together with the occupation forces fled from the Marches and Algeria, set up the (unrecognized) kingdom of Sicily (incl. Tunis, Malta, the Baleares).