Abu Shamaleh said they had issued a warning on Saturday in which they blamed the UN for "turning people away from Islam."
The men had said John Ging, director of the United Nations Relief and Works Agency for Palestine Refugees in the Near East (UNRWA) in Gaza, was "at the head" of an alleged movement to weaken people's faiths.
Abu Shamaleh said the shooting appeared to have been carried out by the same group who had been behind a string of bombings of internet cafes and pool halls in Gaza.
He said the clashes between Palestinian security officials and the men took place as people were leaving the festival.
Adnan Abu Hasna, a spokesman for the UNRWA said Ging was inside the school when the shooting broke out.
He said that no agency staff had been wounded but that Ging remained trapped inside the school.
Police said they had arrested two of the men and were interrogating them.
In March, Ging escaped an attempt to seize him after his convoy came under fire.
The incident prompted the UN to take stronger security measures, including providing police escorts for senior staff.
Mahmoud Abbas, the Palestinian president and Ismail Haniyeh, the Palestinian prime minister, are expected to meet on Sunday to discuss security in Gaza and the West Bank.