The Third Battle of Gaza was fought on the night of 1–2 November 1917 between British and Ottoman forces during the Sinai and Palestine Campaign of World War I and came after the British Egyptian Expeditionary Force (EEF) victory at the Battle of Beersheba had ended the Stalemate in Southern Palestine. The fighting occurred at the beginning of the Southern Palestine Offensive, and, together with attacks on Hareira and Sheria on 6–7 November and the continuing Battle of Tel el Khuweilfe, which had been launched by General Edmund Allenby on 1 November, it eventually broke the Gaza-to-Beersheba line defended by the Yildirim Army Group. Despite having held this line since March 1917, the Ottoman Army was forced to evacuate Gaza and Tel el Khuweilfe during the night of 6–7 November. Only Sheria held out for most of 7 November before it too was captured.Following British defeats at the First and Second battles of Gaza in March and April 1917, Lieutenant General Philip Chetwode commanding the EEF's Eastern Force and Kress von Kressenstein's Ottoman Empire force had each adopted a defensive posture and a stalemate had developed in Southern Palestine. Entrenched defences approximately on the lines held at the end of the second battle were strengthened, and both sides undertook regular mounted reconnaissances into the open eastern flank. In late June, Allenby replaced General Archibald Murray as commander of the EEF, which he quickly reorganised. At about the same time, the Ottoman Fourth Army was also restructured. As the stalemate continued in terrible conditions through the summer, reinforcements began to arrive to replace the large number of casualties suffered by the EEF during the previous fighting for Gaza, while several additional divisions also arrived. The Ottoman defenders were also reinforced at this time, and both sides carried out training while manning the front lines and monitoring the open eastern flank. By mid-October, as the Battle of Passchendaele continued on the Western Front, the last of the British reinforcements arrived as Allenby's preparations to commence a campaign of manoeuvre neared completion.
Prior to the Second Battle of Gaza, the town had been developed into a strong modern fortress, with entrenchments, wire entanglements and a glacis on its south and south–eastern edges. A series of field works, mutually supported by artillery, machine guns and rifles, extended from Gaza eastwards to within 4 miles (6.4 km) of Beersheba. Beginning on 27 October, the EEF began a heavy and almost continuous bombardment of Gaza. During this time, the EEF's XXI Corps, holding the Gaza section of the line, had been mostly passive until the night of 1/2 November, when a series of determined night-time assaults were mounted against the Gaza defences. Yet these attacks were only partially successful due to the strength of the garrison. The bombardment of Gaza intensified on 6 November and during the night of 6/7 November successful attacks were launched on several trench systems. On the morning of 7 November, Gaza was found to have been evacuated during the night. The Gaza to Beersheba line subsequently collapsed and the Ottoman Seventh and Eighth Armies were forced into retreat. Following several battles during the pursuit, the EEF captured Jerusalem on 9 December 1917.