The formations, loyal to the Polish government-in-exile, were first formed in France and its Middle East territories following the defeat and occupation of Poland by Germany and the Soviet Union in September 1939. After the fall of France in June 1940, the formations were recreated in the United Kingdom. Making a large contribution to the war effort, the Polish Armed Forces in the West was composed of army, air and naval forces. The Poles soon became shock troops in Allied service, most notably in the Battle of Monte Cassino during the Italian Campaign, where the Polish flag was raised on the ruined abbey on 18 May 1944, as well as in the Battle of Bologna and the Battle of Ancona (both also in Italy), and Hill 262 in France in 1944. The Polish Armed Forces in the West were disbanded after the war, in 1947, with many former servicemen forced to remain in exile.