Axis forces were at one point only 150 miles from Cairo but Allied soldiers finally gained the upper hand following the British victory at El Alemain in 1942 , and Egypt remained firmly in British hands for the rest of the war .
Axis forces got within 50 miles of Cairo .