More stable than other countries in the region, Tunisia still has struggled with violence by Islamic extremists who have sworn allegiance to al-Qaeda and the Islamic State.
Wednesday's attack was the worst in the country since an al-Qaeda member detonated a truck bomb in front of a synagogue on the island of Djerba in 2002, killing 21, mostly Germans.
The U.S. Embassy was attacked in 2012, after the release of an online video on the prophet Muhammad, seriously damaging the embassy grounds and an adjoining American school. Four assailants were killed.
Overall, violence in Tunisia in recent years has been largely focused on security forces, with dozens killed by extremists.
The 2013 killing of two opposition leaders triggered the fall of Islamist-led governments.