In mid-1942 the Axis forces defeated the Commonwealth force in Libya and advanced into north-west Egypt. In June, the British Eighth Army made a stand just over west of Alexandria, at the railway siding of El Alamein, and the 9th Division was brought forward to reinforce this position. The lead elements of the Division arrived at El Alamein on 6 July, and the Division was assigned the most northerly section of the Commonwealth defensive line. The 9th Division played a significant role in the First Battle of El Alamein (1 to 27 July 1942), which halted the Axis advance, though at the cost of heavy casualties, including the entire 2/28th Infantry Battalion, which was forced to surrender on 27 July. Following this battle the division remained at the northern end of the El Alamein line and launched diversionary attacks during the Battle of Alam el Halfa in early September.