Both sides said the fighting started when a Hamas member posted an Islamist pamphlet near a mosque loyal to Fatah.