Three weeks after it began its offensive in the Gaza Strip, Israel announced a unilateral ceasefire, followed hours later by Hamas announcing a one-week ceasefire. The BBC News website looks at the background to the conflict and what the ceasefire means.
Why has Israel declared a ceasefire and what are its terms?
The ceasefire was unilaterally declared by Israel, 22 days after its offensive began. Israeli Prime Minister Ehud Olmert told the nation Hamas had been "badly beaten" and that Israel's goals "have been more than fully achieved". The goals had been to stop rocket fire into southern Israel and, in the words of Foreign Minister Tzipi Livni, "to change realities on the ground".
Israel has been under intense diplomatic pressure to end its action and a day before the ceasefire received assurances from the United States that it would take concrete steps to halt the flow of arms and explosives into the Gaza Strip.
Israel said its soldiers would remain inside Gaza for the time being and reserve the right to strike back if militants continued to launch attacks.
How did Hamas react?
Hamas rejected Israel's ceasefire in advance, saying it would fight on. Hamas spokesman Fawzi Barhoum said Israel must withdraw its troops and end its 19-month blockade of the strip.
Hours after the ceasefire began, at 0200 (0000 GMT) on 18 January, Hamas militants shot at Israeli troops in northern Gaza, drawing return fire, and fired rockets into southern Israel, triggering an Israeli air strike in response, the Israeli military said.
But then the group announced its own immediate one-week ceasefire, demanding that Israel withdraw its forces from the Gaza Strip.
Hamas' deputy chief in Syria, Moussa Abou Marzouk, also reiterated long-standing demands for all the crossings to be re-opened for the entry of humanitarian aid, food and other necessities.
Why did the Israelis launch their 27 December offensive?
The Israelis say they attacked in order to stop the firing of rockets into Israel. Israel wants all firing to stop and measures to be taken to prevent Hamas from re-arming. It is trying to destroy or reduce Hamas as a fighting force and to capture its stocks of weapons to help achieve this.
The Israeli attack began on 27 December 2008, not long after Hamas had announced that it would not renew a ceasefire that had started in June 2008.
Why did Hamas not renew the ceasefire?
The six-month ceasefire, brokered by the Egyptians, was often broken in practice. Its terms were never written, but were widely understood to include Hamas ending all rocket fire from Gaza and weapons smuggling from Egypt, while Israel stopped military activity against militants in the strip and carried out a phased lifting of its blockade of Gaza. Negotiations on the captured Israeli soldier Gilad Shalit were also supposed to begin.
Rocket fire was greatly reduced, though not completely stopped, for the first few months of the truce. The volume of goods allowed into Gaza also increased for some of the time, but remained well below pre-embargo levels.
Events began to come to a climax after the Israelis carried out their first incursion into southern Gaza during the truce, killing six militants, on 4 November 2008. Israel said its troops entered to destroy a tunnel which could be used to abduct its soldiers. This led to the further firing of Hamas missiles into Israel and in turn to a much tighter Israel blockade.
Hamas said Israel had broken the truce by failing to lift the blockade; Israel said Hamas had used the period to smuggle more rockets into Gaza, was planting explosive devices on the border fence and had not stopped the rocket fire completely.
Hamas demanded that the blockade be ended or it would not renew the ceasefire.
Why does Hamas fire missiles into Israel?
Hamas is an acronym for the Islamic Resistance Movement. It regards the whole of historic Palestine as Islamic land and therefore views the state of Israel as an occupier, though it has offered a 10-year "truce" if Israel withdraws to the lines held before the war of 1967.
It therefore generally justifies any actions against Israel, which has included suicide bombings and rocket attacks, as legitimate resistance.
Specifically in Gaza, it argued that Israel's blockade justified a counter-attack by any means possible.
What casualties have the Hamas rockets caused?
Since 2001, when the rockets were first fired, more than 8,600 have hit southern Israel, nearly 6,000 of them since Israel withdrew from Gaza in August 2005. The rockets have killed 28 people and injured hundreds more. In the Israeli town of Sderot near Gaza, 90% of residents have had a missile exploding in their street or an adjacent one.
The range of the missiles is increasing. The Qassam rocket (named after a Palestinian leader in the 1930s) has a range of about 10km (6 miles) but more advanced missiles, including versions of the old Soviet Grad or Katyusha, possibly smuggled in, have recently hit the Israeli city of Beersheba, 40km (25 miles) from Gaza and brought 800,000 Israelis into range.
Palestinian medical sources say that more than 1,000 people have been killed in Gaza during Israel's military that started on 27 December 2008.
What have been the effects of the Israeli blockade?
They have been severe. Little but humanitarian basics have been allowed into Gaza since Hamas seized power in 2007. Before the Israeli operation began, health, water, sewage and power infrastructure were seriously ailing because of a lack of spare parts. The blockade includes limits on fuel, which have on several occasions forced the power plant that supplies Gaza City to shut down.
A total ban on exports has left the already fragile economy devastated. Unemployment has soared. The United Nations Relief and Works agency (Unrwa) provides basic food aid to about 750,000 people in Gaza, but in the weeks preceding the Israeli operation these were suspended because the UN ran out of food because Israel closed the crossings into Gaza citing security reasons.
Goods ranging from food to missiles have, however, been brought in through smuggling tunnels from Egypt.
What is the history of this small strip of land?
Gaza was part of Palestine when it was administered by Britain in a mandate granted by the League of Nations after World War I. In fighting after Israel declared its independence in large areas of Palestine in 1948, the Egyptians captured the Gaza Strip. Palestinian refugees from the coastal cities to the north took refuge there. They or their descendants still live in UN camps in Gaza. Israel captured it in the war of 1967 and eventually moved about 8,000 settlers there, but all Israeli settlers and soldiers left in 2005.
Gaza has a population of 1.4 million of whom about some three-quarters are registered with the United Nations as refugees. It is 40km (25 miles) long and between six and 12km (4 and 8 miles) wide.
How did Hamas come to control Gaza?
After the Israeli evacuation in August 2005, the Palestinian Authority took control of Gaza. The PA was made up mainly of secular-minded Palestinian nationalists from the Fatah party, which, unlike Hamas, thinks that a final agreement with Israel for a two-state solution - Israel and Palestine - can be made.
In January 2006, Hamas won elections to the Palestinian legislature and formed a government in Gaza and the Palestinian territories on the West Bank. A unity government between Hamas and Fatah was then formed in March 2007 but the Palestinian Authority President Mahmoud Abbas, a Fatah leader directly elected in an earlier vote, subsequently dissolved the government.
In June 2007, Hamas, claiming that Fatah forces were trying to launch a coup, took control of Gaza by force, but not the West Bank territories.
Hamas was boycotted by the international community, which demands that it renounce violence and recognise Israel.