Control of the eastern Mediterranean was seen as vital to Britain's interests. A large garrison of British and Commonwealth troops was based in Egypt. Its main role was to defend the Suez Canal and protect Britain's oil supplies from the Persian Gulf.
On 11 June 1940 Italy's Fascist dictator, Benito Mussolini, declared war on Britain and France. Seeking to expand their African Empire, on 13 September the Italians invaded Egypt from their colony Libya.
After a limited advance the Italians halted and set up a series of fortified camps around Sidi Barrani. In December 1940 General Sir Archibald Wavell's Western Desert Force of 36,000 men attacked the Italians.
A mobile armoured force under Lieutenant-General Richard O'Connor outflanked the Italians at Beda Fomm and pursued them 840 km (500 miles) back to Libya. Wavell's offensive ended at El Agheila on 7 February 1941 with the destruction of nine Italian divisions and the capture of 130,000 men.
Hitler realised that he would have to support the Italians and on 11 February 1941 Major-General Erwin Rommel's Afrika Korps landed at Tripoli. The British won some spectacular victories over the Italians, but found the Germans a much tougher nut to crack.
Logistics were a key factor in the desert war. Throughout the campaign both sides found that the further they advanced, the harder it was to keep their forces supplied. Both suffered shortages of fuel at crucial moments. Rapid advances were often followed by equally rapid retreats. Rough terrain and constant sand abrasion on engines made vehicles break down.
In the desert natural water supplies were almost non-existent. Water had to be transported in vehicles like this bowser. Half of each man's daily ration of 4.5 litres went for cooking and topping up vehicle radiators. The rest was for drinking, washing and shaving.
Visibility in the desert was hampered by heat haze, dust and sandstorms. Although troops were kept fit by their officers, adequate drinking water and medical supplies were not always available.
Troops had to survive extremely high daytime temperatures and very cold nights. Newly arrived men generally spent time acclimatising in the Nile delta before moving into the desert.
Disease also took a toll on the troops, who were constantly irritated by millions of flies attracted by food, human waste and dead bodies.
To remedy these problems, combatants tried to keep their sections of the desert clean.
Not only did the Germans have in Rommel a daring and imaginative commander, but also for several months their tactics proved superior to those of the British.
The main problem for the British was the lack of co-operation between their armour and infantry, which resulted in them fighting almost separate battles.
The result was that the infantry did not receive the support it might have done and the armour frequently fell victim to co-ordinated enemy attacks.
On 24 March 1941 Rommel attacked, cutting off the British 3rd Armoured Brigade. Wavell's force had already been weakened by the transfer of troops to Greece and East Africa.
By 13 April the British had been forced back to the Egyptian frontier, leaving the 9th Australian Division besieged in Tobruk. They held out, but after two attempts to relieve Tobruk failed, Wavell was replaced as Commander-in-Chief Middle East by General Sir Claude Auchinleck.
On 18 November 1941 Auchinleck launched Operation Crusader, surprising Rommel as he was launching an offensive of his own against Tobruk. After several days of confused tank battles around Sidi Rezegh, Rommel advanced towards the Egyptian frontier, hoping to cut off the British.
The Germans had outrun their fuel supplies and their attack ground to a halt, enabling the British to drive them back. Tobruk was relieved on 7 December and Rommel was forced to fall back on El Agheila.
'We have a very daring and skillful opponent against us, and, may I say across the havoc of war, a great general.'
Prime Minister Winston Churchill discussing Rommel in Parliament, 1942
The Western Desert Force was now re-designated the 8th Army and was placed under the command of Lieutenant-General Neil Ritchie. He replaced Lieutenant-General Alan Cunningham.
In January 1942 Rommel attacked again. The British were overextended and had not replaced their earlier losses. Rommel was able to advance beyond Benghazi.
From early February to late May 1942 Rommel was halted by the heavily mined British defensive line, which ran from Gazala in the north to Bir Hacheim in the south.
At the end of May 1942 the Germans launched a fresh offensive and, after two weeks of heavy fighting, broke through.
They captured Tobruk and pushed the British back into Egypt.
Although he halted Rommel's advance at the First Battle of El Alamein in July 1942, Auchinleck was replaced by Lieutenant-General Sir Harold Alexander as Commander-in-Chief Middle East. At the same time, Lieutenant-General Bernard Montgomery took over command of the 8th Army.
Montgomery exuded confidence and rapidly restored the army's flagging morale. Through Alexander he also ensured that his army was properly supplied.
In late August 1942 Rommel made a last effort to break through but short of fuel and supplies, was repulsed at Alam Halfa. For nearly two months Montgomery continued to train and re-equip his army.
‘Montgomery is a first-class trainer and leader of troops on the battlefield, with a fine tactical sense. He knows how to win the loyalty of his men and has a great flair for raising morale.’
Lieutenant-General Sir Harold Alexander, 1942
By October 1942 he enjoyed a significant advantage in men, artillery, tanks and aircraft. He was ready to mount an offensive of his own. On the night of 24 October 1942, under cover of a 600-gun barrage, the 8th Army attacked the Axis positions. After ten days of bitter attritional fighting, the heavily defended German line was breached.
On 4 November 1942 Montgomery's armour broke through and the pursuit of the defeated Germans and Italians began. Tobruk and Benghazi were soon retaken and by 23 November the British were back at El Agheila. By March 1943 the 8th Army had taken Tripoli and crossed into Tunisia.
Meanwhile, on 8 November 1942, the Allies had landed in French North Africa (Morocco and Algeria). The invasion force, codenamed Operation Torch, was commanded by General Dwight Eisenhower and included the British 1st Army.
After their initial resistance, the Vichy French agreed to a ceasefire. The Allies advanced into Tunisia, but the Germans reacted quickly and succeeded in blocking the route to Tunis at Kasserine.
Eisenhower was forced to consolidate his forces and develop his lines of communication so they could support a major attack in tandem with the 8th Army. This was done despite ongoing German resistance and by 20 March 1943 the advancing 8th Army had linked up with Eisenhower.
The pressure on the Axis perimeter around Tunis increased and on 7 May the Allies entered the city. Five days later 250,000 German and Italian troops surrendered. The battle for North Africa was over.