Officials in Haniyeh's office said the attack did not appear to be an assassination attempt, but it comes at a time of growing tensions between rival Palestinian factions that have sparked fears of civil war.
"The prime minister is alright and he is out of the area which witnessed the gunfire. His car was not attacked," one official in Haniyeh's office said.
Attack doesn't bode well for Hamas-Fatah deal. Gunmen in Gaza (Archive photo: AFP)
Officials said gunfire hit vehicles of a Hamas-led police force that was behind cars carrying Haniyeh, who had just finished a speech at a mosque. One of the vehicles was torched. Hamas security officials returned fire, officials said.
During his speech, Haniyeh said he would reject any moves by President Mahmoud Abbas to oust his government.
Abbas has hinted he might fire the Hamas government after efforts to form a unity cabinet foundered over the Islamist movement's refusal to soften its stance toward Israel.
The incident occurred less than 12 hours after the rival factions reached an agreement through the mediation of Egypt’s permanent security delegation to Gaza which calls for an immediate cessation of violence and an end to incitement and mudslinging on Palestinian media outlets.
Ali Waked contributed to the report