Mitau became a battleground between Bolshevik Red Guards, German paramilitaries, and Latvian freedom-fighters. After the victory of the latter group in November 1919, Mitau, renamed to Jelgava, became an important city in independent Latvia. In 1925 a sugar factory was built in Jelgava, the first such factory in Latvia. In 1939 Latvia University of Life Sciences and Technologies opened in the Jelgava Palace. As a result of the Nazi-Soviet Pact of 1939, Jelgava was occupied and annexed with the rest of Latvia by the Soviet Union in 1940. Many of the city's remaining German population were resettled into the territory of German-occupied Poland during the Nazi–Soviet population transfers. German forces from Army Group North occupied Jelgava from 1941 to 1944 until the capture of the city by the Red Army. During World War II, German police along with Latvian auxiliary police murdered the Jewish inhabitants of the city during a series of mass shootings (see Jelgava massacres). The main synagogue was burned to the ground. In late July 1944, the Soviet Red army launched an attack from the south in the direction of Jelgava and Tukums to encircle the German Army Group North. Jelgava was declared a fortress (Festung) however, there were only a few scattered German and Latvian units in the city. From 30 July until 7 August, after heavy street fighting and several air raids, the Red Army managed to occupy the left bank of the Lielupe river. In late August, the German army launched a counterattack on Jelgava from the north but it failed to drive back the Soviets. Jelgava remained on the frontline until 10 October when the German army retreated to Courland. The city's historic centre, industry, rail network, and public buildings were heavily damaged by the fighting, with almost 90% of the city destroyed. Among lost buildings was famous Kurland Provincial Museum and Athenaeum. Jelgava was rebuilt in typical Soviet style after World War II as part of the Latvian SSR. Jelgava became home to several big factories. Among them were the sugar factory, which was heavily expanded from 1975 assembly line, and administration buildings for the Riga Autobus Factory (RAF). Following Latvian independence, Jelgava has slowly regained its original Germanic heritage and is now a popular tourist site. Owing to Latvia University of Life Sciences and Technologies, many of Jelgava's inhabitants are students or people connected with education. For this reason Jelgava is