Hamas has turned its anger over Israel's assassination of three military commanders against alleged collaborators in Gaza, killing 21 people in a little over 24 hours and warning that the "same punishment will be imposed soon on others".

The suspected informers – including two women – were killed in three batches in a campaign codenamed "Strangling Necks". Three were killed on Thursday, 11 at a disused police station early on Friday, and another seven shot dead in public outside a mosque in Gaza City shortly after noon prayers.

The conflict seemed likely to escalate further on Friday afternoon after a four-year-old Israeli child was killed when a mortar hit a car close to the Gaza border. It was the first civilian death in Israel since fighting resumed after the collapse of the latest temporary ceasefire earlier this week, and was expected to trigger a strong response from the Israeli military.

The boy is the fourth civilian and the first child to be killed in Israel since the war began. Sixty-four soldiers have also died. More than 500 children have been killed in Gaza, out of a total of more than 2,000 deaths.

The summary executions in Gaza triggered swift condemnation from Palestinian and international human rights organisations. Raji al-Surani, the director of the Gaza-based Palestinian Centre for Human Rights, said: "We demand the [Palestinian Authority] and the resistance [militant groups] to intervene to stop these extra-judicial executions, no matter what the reasons and the motives are."

Pictures showed a group of men, with their heads covered and hands tied behind their backs, kneeling against a wall. Masked Hamas fighters dressed in black and armed with AK47s pushed to them to the ground before shooting them.

The mosque's imam asked worshippers to inform Hamas security officials about anyone suspected of behaving strangely, or asking about fighters. "We have to protect our mujahideen [fighters] and back them, not let the Zionist occupation [Israel] easily target them as happened in Rafah with commanders," he said.

A notice attached to a wall detailed the charges against one suspect. It said he or she had provided "information to the enemy on the places of mujahideen [fighters], standing positions, tunnels, the places of explosive devices, and their houses and rockets", allowing Israel to target its air strikes. "And upon that the justice revolutionary verdict was implemented."

The Hamas-run Al Rai website suggested a direct link between the executions and Israel's targeting of Hamas commanders, saying "the current circumstances forced us to take such decisions".

The suspects were believed to have been arrested before the assassination early on Thursday of three top Hamas military leaders in Rafah and the possible death of military chief Mohammed Deif in an air strike in Gaza City on Tuesday, which killed his wife and two children.

The killings were an unambiguous warning to informers. Hamas claimed that a verdict and sentence was handed down by a court, although it is unlikely that the suspects went through a fair and impartial judicial process.

A statement issued in the name of "the Palestinian resistance" said that the court's sheikhs ordered the executions of "collaborators who betrayed their religion and sold their people and land for a cheap price, and achieved many missions for the enemy".

It said it had not named the suspected informers "for keeping the reputation and honour of their families and children". Anyone who "allows himself to be a tool of enemy crimes will definitely face the same destiny", it added.

Some of those at the mosque expressed approval of the killings. "It was a late move – I wish it was from the beginning, and I hope it continues until we reach a community empty of traitors and collaborators," said Mohammed Wasfi.

The suspected collaborators deserved to die, said Awni Switti. "Palestinians have to stop this cheap assistance to the enemy." But he added: "I hope they have checked and investigated with them carefully before they made this decision."

Kenneth Roth, executive director of Human Rights Watch, condemned the killings. "No justification for #Hamas summary execution of 11, informer or not. No due process. Executions always wrong," he wrote on Twitter.

Collaboration with Israel is punishable by death under Palestinian law, though the death sentence requires presidential approval. Hamas has repeatedly carried out summary executions. In the last conflict in Gaza, in November 2012, several suspected informers were killed and the body of at least one was dragged through the streets of Gaza City by a motorcycle.

Israeli intelligence relies heavily on informers in Gaza and the West Bank. Sometimes people are coerced or blackmailed into becoming collaborators; sometimes the motive is financial. If exposed, they risk death and their families – whether they knew or not – are ostracised.

The killing of the three military commanders in Rafah was a significant blow to Hamas after weeks in which senior political and military figures had avoided being targeted by the Israel Defence Forces, largely by keeping underground in a network of bunkers and tunnels and refraining from using mobile phones.

Deif's fate was still unclear. Israeli officials said they were confident that he had died in the blast but no conclusive evidence was produced.

Ismail Haniyeh, the most senior Hamas politician in Gaza, said in a statement that "despite the pain" of losing the military commanders, "the history of the Hamas movement has proven more than once that it is stronger after every targeted killing of one of its senior members. After a senior operative is killed, we immediately continue on our path without hesitating or stepping back."

Diplomatic efforts to end the conflict shifted from Cairo to New York, with a United Nations security council resolution drafted by Britain, France and Germany with US support. According to reports in the Israeli media, it called for an immediate cessation of fighting, the opening of crossings in and out of Gaza, international supervision to prevent weapon smuggling and the construction of tunnels, and the Palestinian Authority to be the governing authority. No date had been set for debating and voting on the proposal.

The Palestinian president Mahmoud Abbas was in Qatar meeting Hamas's political leader, Khaled Meshaal, to push him to return to a ceasefire, and to encourage Qatar to support Egyptian efforts to mediate a truce, a Palestinian official said.

Abbas was due to travel to Cairo later on Friday to meet Egyptian intelligence officials to discuss ceasefire efforts.