Explanation:

The victory of the Axis Forces in the Battle of Gazala (May and June of 1942), which led to the capture of the port Tobruk in Libya, opened the possibility of an advance to grab Egypt, following the retreat of the British 8th Army.

So Field Marshal Erwin Rommel (leading the Afrika Korps , the Panzerarmee Afrika and Italian divisions) launched the offensive that was delayed, next to the Egyptian border, in the Battle of Mersa Matruh, what allowed time to the British to prepare their defenses in El Alamein, within 80 km (50 mi) of Alexandria.

So when the Axis Forces reached positions next to El Alamein, they where detained by the British forces (in the 1st Battle of El Alamein).

Then the Axis Forces, with logistic problems, after without success trying to envelop the British in the Battle of Alam el Halfa, established a deffensive line. With reinforced forces the British, commanded by Lieutenant-General Bernard Montgomery, were able to break the German-Italian line; unable to hold position, and sustaining great losses, the German-Italian forces retreated almost unopposed out of Egypt.

This battle marked an important turning point of the Western Desert Campaign and it was the first major victorious offensive of the Western Allies.