The Battle of Gazala (near the modern town of Ayn al Ghazālah) was fought during the Western Desert Campaign of the Second World War, west of the port of Tobruk in Libya, from 26 May to 21 June 1942. Axis troops of the Panzerarmee Afrika (Generaloberst Erwin Rommel) consisted of German and Italian units. Allied forces (Commander-in-Chief Middle East, General Sir Claude Auchinleck) were mainly British, Indian, South African and Free French.
Rommel secretly had the advantage of detailed advance intelligence of the Allies, resulting from an unwitting breach of communications security by Bonner Fellers a military attaché at the US embassy in Cairo. The most secret data on British "strengths, positions, losses, reinforcements, supply, situation, plans, morale etc" was read by German signals intelligence in Africa, within eight hours of their transmission to Washington. This calamitous situation endured from December 1941 until 29 June 1942 (after the fall of Tobruk), when the US Black Code was replaced.
The Axis distracted the British with a decoy attack in the north and made the main attack round the southern flank of the Gazala position. The advance succeeded, but the defence of the French garrison of Bir Hakeim, at the southern end of the line, left the Axis with a long and vulnerable supply route around the Gazala line. Rommel retired to The Cauldron, a defensive position backing onto British minefields, forming a base in the midst of the British defences and Italian engineers lifted mines from the west side of the minefields to create a supply route through to the Axis side.
The Eighth Army counter-attack, Operation Aberdeen, was poorly co-ordinated and defeated in detail; many tanks were lost and the Axis were able to regain the initiative. The British withdrew from the Gazala Line and the Axis troops overran Tobruk in a day. Rommel exploited the success by pursuing the British into Egypt, denying them time to recover from the defeat. As both sides neared exhaustion, the Eighth Army managed to check the Axis advance at the First Battle of El Alamein. The battle is considered the greatest victory of Rommel's career, but Operation Herkules, a plan to attack Malta, was postponed to concentrate on the pursuit. The British managed to supply Malta and revived it as a base for attacks on Axis convoys to Libya, greatly complicating Axis supply difficulties at El Alamein.