Officials in Tunisia say a police officer killed at least four people near a synagogue after stealing ammunition from a colleague.