Tunisian police were exchanging gunfire Thursday with armed "terrorists" who had taken refuge in a town near the capital, the interior ministry said.