The use of tunnels in Gaza began approximately a decade and a half ago, on the border with Egypt, to smuggle weapons into Gaza under the Israel Defense Forces (IDF) border security.
Very quickly, in addition to smuggling weapons, the tunnel operators began importing any kind of sellable civilian wares.
After Israel withdrew from Gaza, the number of smuggling tunnels jumped from a few dozen to hundreds as more and more Gazans got involved in this lucrative business.
Taxes imposed by the Hamas government on the imports were a major source of its revenue. After the Egyptian military overthrew the Muslim Brotherhood government, the new regime shut down these tunnels - this being one of the causes of the present economic crisis in Gaza.
From 2001 the Palestinians began using explosive-filled tunnels to attack Israeli border posts. There were not many attempts to do this because the effort far exceeded the benefit - casualties were light and it was much easier to achieve them by other means.
In 2006, the Palestinians tried something new - a tunnel was dug underneath the Gaza-Israel border and an assault team emerged behind an Israeli border post.
The Israeli soldiers were surprised - two were killed, one wounded and one - Gilad Shalit - abducted.
After taking control of Gaza, Hamas began a project to build a maze of underground concrete bunkers connected with tunnels and multiple entrances and exits underneath the residential areas of Gaza.
These underground complexes are fairly similar in concept to the Viet Cong tunnels dug beneath the jungles of South Vietnam, though the quality of finishing is better, with concrete walls and roofs, electricity and other required amenities for lengthy sojourn.
Maintenance of a concrete tunnel is fairly simple - virtually nil unless there is groundwater that needs pumping. Without the concrete walls and roof the tunnel would gradually deteriorate (in the area of Gaza most of the soil is soft, with very little bedrock) and require re-digging and shoring up.
The smuggling tunnels under the border with Egypt are generally bigger and better equipped to enable continuous operation and transfer of bulky items, whereas infiltration tunnels are meant to be used at most once or twice and only wide enough for an armed man to walk through.
The purpose of the defensive tunnels is to enable the Hamas command structure to reside safely underground while their armed forces conduct a mobile defence against Israeli forces.
Many of the tunnels are interconnected to enable travelling underground from one to the other, with multiple camouflaged openings to emerge above ground in different locations.
This enables surprise attacks on the IDF units from different directions and then disappearing again underground to emerge and attack somewhere else.
The exact extent of these complexes is not known, though the Israeli army estimates there are dozens.
The entrances and probably the tunnels themselves are booby-trapped with explosives. These were first used during the Israeli offensive against Gaza in 2008-09. They were deemed successful so the project was expanded and accelerated.
After the failure of Hamas' rocket forces to inflict significant damage on Israeli towns in November 2012, they decided to build a large offensive-tunnel capability that would enable them to infiltrate assault teams into Israeli villages within a few kilometres of the border or place large bombs underneath these villages.
The IDF knew of this plan but failed to find and destroy more than a few tunnels.
Hard to detect
Detecting tunnels requires either detecting the entrance to the tunnel or "seeing" the tunnel itself with various acoustic, seismic or radar detection devices.
Even after detecting an entrance, one does not know the exact route of the tunnel from there to the border.
To hide the tunnel work from Israeli intelligence, the entrances are mostly located on the bottom floor of houses, mosques, schools or other public buildings.
Digging smuggling and offensive tunnels is a long manual process, usually of several months, because the use of motor diggers would create a noise that could be heard by Israeli listening posts.
Removal of the earth from the site is done gradually and camouflaged by various ruses.
As yet no reliable technology has been developed that can cover a wide area and see a man-sized tunnel to a depth of more than a few meters underground.
The tunnels dug by Hamas are usually about 65ft (20m) underground - so, even if you know the approximate location, they are almost impossible to detect.
Therefore to discover the tunnels, the Israelis must either have excellent intelligence from within Gaza or they must go in and search for them house by house.
Destroying a tunnel is a lengthy and somewhat complex operation because just blowing in the entrance or some of the airshafts leave most of the tunnel intact, so Hamas sappers will be able to quickly dig by-pass sections and continue to use the tunnel.
Therefore, the entire length of the tunnel and its branches must be located, mapped and then completely destroyed.
Dr Eado Hecht is a defence analyst and lecturer in military doctrine at the Begin-Sadat Center for Strategic Studies at Bar Ilan University.
Correction 5 February 2015: This page has been amended following complaints that were upheld by the BBC's Editorial Complaints Unit.