TIMELINE-Major events during seven weeks of war between Israel and Hamas

(Updates headline)

Nov 22 (Reuters) - Israel and Hamas have agreed to a ceasefire in Gaza for at least four days, to let in aid and release at least 50 hostages captured by militants in exchange for at least 150 Palestinians jailed in Israel.

The following is a timeline of the war between Israel and Hamas, the Islamist movement which controls the Gaza Strip.

Oct. 7: Hamas gunmen launch a surprise attack on southern Israel, crossing over from Gaza and rampaging through towns. Israel says the gunmen kill 1,200 people, mainly civilians, and take more than 240 hostages.

Hamas military commander Mohammad Deif announces on Hamas media that the attack has started and urges Palestinians everywhere to fight.

Israeli Prime Minister Benjamin Netanyahu says Israel is "at war" and retaliatory air strikes against Hamas-run Gaza begin, along with a total siege of the narrow coastal enclave squeezed between Israel and Egypt.

Oct. 13: Israel tells residents of Gaza City, where more than 1 million of the enclave's 2.3 million people live, to evacuate and move south. Gaza remains closed and residents say they have nowhere to go after southern parts of the Strip are bombarded.

Oct. 17: An explosion at al-Ahli al-Arabi Baptist hospital in Gaza City causes heavy casualties and triggers outrage in the Arab world. Palestinians blame the blast on an Israeli air strike but Israel says it was caused by a misfiring Palestinian rocket launch.

The health ministry in Gaza says 471 people were killed. Israel disputes this figure and an unclassified U.S. intelligence report estimates the death toll "at the low end of the 100 to 300 spectrum".

Oct. 18: U.S. President Joe Biden visits the Middle East to show support for Israel and prevent a wider regional conflict. He ascribes the hospital blast to an errant rocket fired by Gaza militants. Arab leaders respond to the deaths at the hospital, which they blame on Israel, by cancelling a summit with Biden in Jordan.

Oct. 20: Hamas releases two American hostages - Judith Tai Raanan, 59, and her daughter Natalie, 17. The women were taken from Nahal Oz kibbutz in southern Israel.

Oct. 21: Aid trucks are allowed through the Rafah border crossing from Egypt into Gaza after days of diplomatic wrangling. It is only a small fraction of what is required in Gaza, where food, water, medicines and fuel are running out.

Oct. 23: Hamas releases two more hostages, elderly Israelis Nurit Cooper and Yocheved Lifshitz, "on humanitarian and poor health grounds". The two women were kidnapped from Nir Oz kibbutz in southern Israel with their husbands, who are still held by Hamas. As she is freed, Lifshitz shakes hands with one of the militants and says "shalom" (peace).