The city of Gaza, just across the Palestine border and close to the Mediterranean coast, was more than just the gateway to Palestine; it was the heart of the main Turkish defence in southern Palestine and the scene of three major attacks in 1917.
The first attack on 26 March was called off at the point of victory when General Dobell worried that the water so vital for the mounted forces would not be captured soon enough, voiced his concerns to General Chetwode. The Generals, concerned with the slow progress of the infantry, agreed that if the city wasn’t captured by sunset, the operation would be called to a halt and all units would be withdrawn.
After the war a senior officer who was there with the 9th Light Horse Regiment, wrote how surprised he and the men were when they received orders to the effect that the whole force was retire to the Wadi Ghuzze during the night.
"It was the first time our force had received such order, and everyone wondered at the cause, some doubting the genuineness, but as they were verified shortly afterwards it was realized by all that there must be some good and sufficient reason for them." 
To both the infantry and the mounted troops who had by then found water and linked up in eastern streets of the city, the recall was unbelievable.
"The fight was broken off and our men, suffering a sense of disappointment scarcely less than that felt at the evacuation of Gallipoli, were withdrawn." 
In his report to the War Office General Murray wrote that it had been a ‘most successful operation’ with only the fog and lack of available water being all that saved the enemy from complete disaster.
"It has filled our troops with enthusiasm, and proved conclusively that the enemy has no chance against our troops in the open."
In fact, the troops knowing they had decisively beaten the enemy were bitterly resentful about receiving the order to withdraw.
Further resources - https://en.wikipedia.org/wiki/First_Battle_of_Gaza
Although their first attempt to take the city had cost approximately 4,000 casualties (mainly infantry) Generals Murray and Dobell, determined to succeed, developed a plan for a second attempt. Their new plan called for the infantry to conduct a frontal assault while the dismounted men of the Camel Brigade and the Imperial Mounted Division attacked further east. The attack would be supported by six tanks, which in addition to their normal allocation of HE shells were issued gas shells that until then had never been used against Turkish troops.
The ANZAC Mounted Division moved further out to the south-east and there became the screen to repel inland Turkish forces should they attempt to reinforce their comrades in Gaza.
By the time the second Battle of Gaza commenced on 19 April 1917 the Turks had significantly extended and improved their already strong defences. After launching the attack in the early hours of the morning, and fighting all day and into the night, the action here developed into the bloodiest battle the Australians fought in Palestine.
For many hours, they advanced up bare slopes in the face of murderous machine gun fire, high explosive shells, shrapnel and heavy rifle fire. In some places, they made ground, pushed the enemy back, and at a place later named ‘Tank Redoubt’ two companies of the Camel Brigade, in cooperation with the British infantry on their flank, captured for a time one of the key Turkish positions.
The tanks proved to be of limited value against the well sited Turkish redoubts and as for the gas; its affects were so weak that some Turkish commanders reported it as the fumes of high explosive.
The Turks with their force so superior in numbers and equipment stood fast along the Gaza-Beersheba line and after a long, vicious and bloody fight the attack having gained no significant ground, was called off; two days after the battle, Dobell was relieved of Eastern Force.
Major General Sir H G Chauvel was promoted to Lieutenant General, (the first Australian to attain that rank) took command of the Desert Column and Brigadier Chaytor, a New Zealander, took command of the ANZAC Mounted Division.
For further resources - https://en.wikipedia.org/wiki/Second_Battle_of_Gaza
 Darley, T H, With the Ninth Light Horse in the Great War, Adelaide, 1924, p. 79-80
 Gullett, Barrett & Barker - Australia in Palestine - Angus & Robertson, Sydney, 1919, p. 13-14
 Gullett,, H S ,Official History of Australia in the War of 1914–1918, Volume VII, Angus & Robertson, Sydney, 1923, p. 296