Between the wars, he served as an instructor at the Infantry School at Dresden, commanded the German War Academy, and wrote "Infanterie greift an" (Infantry Attacks), a study of infantry tactics, based on his experiences in World War One, which was highly praised as a text for junior officers.
He was selected to command the Fuehrer's bodyguard during the annexation of the Sudetenland and remained to Hitler's staff for the invasion of Poland. He commanded the 7th Panzer Division with distinction in the Battle of France, and was given command of German forces sent to assist the Italians in North Africa, which became the Afrika Korps. On arrival, he started a series of brilliant battles in which he drove the British back hundreds of miles and gained him the nickname of "Desert Fox". At EL Alamein, he came close to taking Egypt and the Suez Canal, but, with his supply lines stretched to the limit, he could not make the final push, nor could he match the reinforcements that were poured into his opponent, General Montgomery. With an enormous numerical advantage in tanks, and assisted by the Allied landings at Casablanca, Montgomery forced Rommel back and eventually, out of Africa.
Rommel served briefly in Italy (1943-44) and then in France, where he greatly strengthened the defenses the Allies would face in the Normandy Invasion. He planned to hold the Allies on the beach, until he could counterattack with his panzers to push the invaders back into the sea; but when he tried to bring up the forces needed for this counterattack, he could not convince Hitler to release them before it was too late. A few weeks later, Rommel was wounded by a strafing fighter and sent home to recover.
On 20 July 1944, Hitler was nearly killed, when a bomb, placed in his headquarters by an officer of the German Army, exploded. The plot involved many of the highest officers in the Army, and no one was safe from the Gestapo in the weeks which followed. Rommel was one of those implicated in the "20th of July plot", but, as he was a popular hero, a public trial could get embarrassing, even for the Nazis. Instead, he was told that if he killed himself, his participation in the plot would be overlooked and his family would be safe. Rommel accepted and was given a hero's funeral.