Since 1912, Italy had occupied Libya because of purely economic "expansion" motives. In 1935, Mussolini began sending tens of thousands of Italians to Libya, mostly farmers and other rural workers, in part to relieve overpopulation concerns in Italy. So by the time of the outbreak of the Second World War, Italy had enjoyed a long-term presence in North Africa, and Mussolini began dreaming of expanding that presence--always with an eye toward the same territories that the old "Roman Empire" had counted among its conquests.
Also sitting in North Africa were British troops, which, under a 1936 treaty, were garrisoned in Egypt to protect the Suez Canal and Royal Navy bases at Alexandria and Port Said. Hitler had offered to aid Mussolini early on in his North African expansion, to send German troops to help fend off a British counterattack. But Mussolini had been rebuffed when he had offered Italian assistance during the Battle of Britain. He now insisted that as a matter of national pride, Italy would have to create a Mediterranean sphere of influence on its own--or risk becoming a "junior" partner of Germany's.
But despite expansion into parts of East Africa and Egypt, Mussolini's forces proved no match for the Brits in the long run. British troops pushed the Italians westward, inflicting extraordinary losses on the Axis forces in an attack at Beda Fomm. As Britain threatened to push the Italians out of Libya altogether and break through to Tunisia, Mussolini swallowed his pride and asked Hitler for assistance. Hitler reluctantly agreed (it would mean the first direct German-British encounter in the Mediterranean)--but only if Mussolini stopped the Italians' retreat and kept the British out of Tripoli, the Libyan capital. But the Italians continued to be overwhelmed; in three months, 20,000 men were wounded or killed and 130,000 were taken prisoner. Only with the arrival of German Gen. Erwin Rommel would the Italian resistance be strengthened against further British advances. Even with Germany's help, Italy was able to defend its North African territory only until early 1943.