The First Battle of El Alamein (1–27 July 1942) was a battle of the Western Desert Campaign of the Second World War, fought in Egypt between Axis forces (Germany and Italy) of the Panzer Army Africa (Panzerarmee Afrika, which included the Afrika Korps) (Field Marshal (Generalfeldmarschall) Erwin Rommel) and Allied (British Imperial and Commonwealth) forces (Britain, British India, Australia, South Africa and New Zealand) of the Eighth Army (General Claude Auchinleck).
The British prevented a second advance by the Axis forces into Egypt. Axis positions near El Alamein, only 66 mi (106 km) from Alexandria, were dangerously close to the ports and cities of Egypt, the base facilities of the Commonwealth forces and the Suez Canal. However, the Axis forces were too far from their base at Tripoli in Libya to remain at El Alamein indefinitely, which led both sides to accumulate supplies for more offensives, against the constraints of time and distance.
Following their defeat at the Battle of Gazala in Eastern Libya in June 1942, the British Eighth Army, commanded by Lieutenant-General Neil Ritchie, had retreated east from the Gazala line into north-western Egypt as far as Mersa Matruh, roughly 100 mi (160 km) inside the border. Ritchie had decided not to hold the defences on the Egyptian border, because the defensive plan there relied on his infantry holding defended localities, while a strong armoured force was held back in reserve to foil any attempts to penetrate or outflank the fixed defences. Since General Ritchie had virtually no armoured units left fit to fight, the infantry positions would be defeated in detail. The Mersa defence plan also included an armoured reserve but in its absence Ritchie believed he could organise his infantry to cover the minefields between the defended localities to prevent Axis engineers from having undisturbed access.
To defend the Matruh line, Ritchie placed 10th Indian Infantry Division (in Matruh itself) and 50th (Northumbrian) Infantry Division (some 15 mi (24 km) down the coast at Gerawla) under X Corps HQ, newly arrived from Syria. Inland from X Corps would be XIII Corps with 5th Indian Infantry Division (with only one infantry brigade, 29th Indian, and two artillery regiments) around Sidi Hamza about 20 mi (32 km) inland, and the newly arrived 2nd New Zealand Division (short one brigade, the 6th, which had been left out of combat in case the division was captured and it would form the nucleus of a new division) at Minqar Qaim (on the escarpment 30 mi (48 km) inland) and 1st Armoured Division in the open desert to the south. The 1st Armoured Division had taken over 4th and 22nd Armoured Brigades from 7th Armoured Division which by this time had only three tank regiments (battalions) between them.
On 25 June, General Claude Auchinleck—Commander-in-Chief (C-in-C) Middle East Command—relieved Ritchie and assumed direct command of the Eighth Army himself. He decided not to seek a decisive confrontation at the Mersa Matruh position. He concluded that his inferiority in armour after the Gazala defeat, meant he would be unable to prevent Rommel either breaking through his centre or enveloping his open left flank to the south in the same way he had at Gazala.[c] He decided instead to employ delaying tactics while withdrawing a further 100 mi (160 km) or more east to a more defensible position near El Alamein on the Mediterranean coast. Only 40 mi (64 km) to the south of El Alamein, the steep slopes of the Qattara Depression ruled out the possibility of Axis armour moving around the southern flank of his defences and limited the width of the front he had to defend.