Lines are blurred when a guerrilla war is fought in as dense a place as Gaza but the IDF's HQ is also surrounded by civilians

In Gaza, Hamas fighters are among civilians. There is nowhere else for them to go

Israel's accusation that Hamas is using civilians as human shields has grown increasingly strident as the war in Gaza worsens.

The charge is laid relentlessly by political and military leaders and media commentators, repeated in conversations by members of the public and echoed in the comments of foreign politicians and diplomats. On the other side of the conflict, the accusation is vigorously denied by Hamas and others in Gaza.

The truth is lost amid the propaganda battle being waged alongside the shells, bombs, guns and rockets. What is certain is that the picture is more complicated than either side claims.

Deliberately placing non-combatants in and around targets to deter enemy attack – the definition of human shields – is illegal under international law.

The Geneva conventions state: "The presence or movements of the civilian population or individual civilians shall not be used to render certain points or areas immune from military operations, in particular in attempts to shield military objectives from attacks or to shield, favour or impede military operations. The parties to the conflict shall not direct the movement of the civilian population or individual civilians in order to attempt to shield military objectives from attacks or to shield military operations."

International law also bans the use of medical units or prisoners of war to deter enemy attack.

However, even if Hamas were violating the law on this matter, it would not legally justify Israel's bombing of areas where civilians are known to be.

"Any violation of these prohibitions shall not release the parties to the conflict from their legal obligations with respect to the civilian population and civilians, including the obligation to take the precautionary measures," the conventions say.

Israel claims Hamas routinely uses hospitals, mosques, schools and private homes to launch rockets at Israel, store weapons, hide command and control centres, shelter military personnel, and conceal tunnel shafts. This is their justification for targeting such places, despite the legal requirement to ensure its attacks are proportional, distinguish between military and civilian objects, and avoid civilian casualties.

Israel says it gives due notice of attack – by phone, text messages, leaflet drops and "warning missiles" – to give civilians the chance to leave.

A typical statement from the Israel Defence Forces, issued in the past few days, says: "While the IDF does everything that it can to avoid civilian casualties, Hamas deliberately puts Palestinian civilian lives in danger. Hamas hides weapons and missile launchers in densely populated areas. Instead of keeping its citizens out of harm's way, Hamas encourages and even forces Gazans to join its violent resistance against Israel. It sends men, women and children directly into the line of fire to be used as human shields for terrorists."

On Wednesday, the IDF released a series of maps purporting to show Hamas military sites close to – but not in – schools, hospitals, mosques and residential buildings. It also released video, which it said showed militants using an ambulance to flee after coming under attack by IDF troops, and said the grounds and vicinity of al-Wafa hospital in Gaza City had been "repeatedly utilised by Hamas and the Palestinian Islamic Jihad as a command centre, rocket-launching site, and a post enabling terrorists to open fire at soldiers".

Israel has repeatedly targeted the rehabilitation hospital during the course of the conflict, finally destroying the heavily damaged and, by then, empty building on Wednesday.

But the hospital's director rejected the Israeli assertion that the hospital had been used for military purposes by Hamas or other militant groups. In a statement, Basman Alashi said: "Israel has targeted our hospital based on false and misleading claims. They are targeting medical facilities, the wounded, the sick and our children, all over the Gaza Strip. They want us to know that nowhere is safe."

He added: "I hope things calm down as soon as possible. It's painful to see what's happening and that the hospital has become a target for military attacks."

The UN's discovery of arms caches in two of its schools in the past week has given Israel's assertions credence. "UNRWA [the UN agency for Palestinian refugees] immediately informed all relevant parties and issued a statement strongly condemning the abuse of its premises," said a spokesman, Chris Gunness. The UN agency UNRWA's shelters have been shelled on four occasions in recent days, despite officials giving precise coordinates to the IDF.

Israel also claimed that Hamas had forced civilians to remain in the Gaza City neighbourhood of Shujai'iya after the IDF warned them to evacuate ahead of its assault on Sunday. Civilians were being "held as hostages", said Peter Lerner, an IDF military spokesman.

These claims have not been backed up by independent reporting from international journalists covering the war from Gaza. Instead, dispatches from the ground have presented complex reasons why some residents did not evacuate from Shujai'iya and other areas targeted by the IDF. Many said nowhere in Gaza was safe, so they saw little point in abandoning their homes.

Others cited worries about not knowing the identities of people who would be their new neighbours; they could be evacuating a familiar neighbourhood for one that was a militant stronghold and others were simply too terrified to go out on the streets. Many media reports said there was no evidence of coercion by Hamas.

In fact, tens of thousands of people have fled their homes for what they hope is a safer place. UNRWA reports that more than 140,000 people have sought shelter in its properties; churches and mosques have been overwhelmed by displaced civilians; the grounds of the Shifa hospital in Gaza City have begun to resemble a makeshift refugee camp. These families are in fear of their lives, but they overwhelmingly cite Israeli bombing and shelling as the cause, rather than threats from Hamas.

Gaza is one of the most overcrowded places on earth. Almost two million people are crammed into a strip of land just 25 miles long and between three and a half and seven miles wide – roughly the same size as the Isle of Wight. In general there are few opportunities to leave; and in the midst of a conflict such as this, there is no exit.

The current war is not being fought on a conventional battlefield. Israel is pounding Gaza from the air, and its troops are increasingly fighting battles against a guerrilla army in densely populated urban areas – which constitute much of the Gaza Strip. As Israeli tanks and troops push further into the towns and cities, it is increasingly likely that Hamas will launch attacks from positions close to civilian buildings.

The separation between "civilian" and "military" in Gaza is much more blurred than with a conventional army – both physically and in the Gazan psyche. Hamas and other militants are embedded in the population. Their fighters are not quartered in military barracks, but sleep at night in their family homes. While it is not difficult to find antipathy to Hamas on the streets of Gaza in quiet times, most people defend their "right to resist" – and under such sustained military attack, support for Hamas rises.

Israel, meanwhile, does not have an unblemished record in the use of human shields. In 2010, two soldiers were convicted in an IDF military court of using an 11-year-old Palestinian boy as a human shield in its 2008-09 operation in Gaza. The pair ordered the child to search bags they suspected of being booby-trapped.

It was the first conviction of what is known within the IDF as the "neighbour procedure" – forcing civilians to assist troops in military operations. Investigations by news organisations and human rights groups have suggested the IDF has used Palestinians as human shields in operations in both Gaza and the West Bank.

Meanwhile, in response to Israel's assertions that Hamas situates its military centres in civilian areas, some have pointed out that the IDF's headquarters, the Kiriya, is in central Tel Aviv, surrounded by a hospital, blocks of flats, shopping centres and offices.