 Later in the war , Hamburg was reduced to a barracks ship for the U @-@ boat flotilla in Wilhelmshaven . During this period , among others , her commanding officers was Korvettenkapitän Friedrich Lützow , who commanded Hamburg from 16 March 1917 to 12 May 1918 . She was among the six light cruisers Germany was permitted to retain by the Treaty of Versailles . In the service of the newly reorganized Reichsmarine , Hamburg served in the active fleet starting in 1920 . In 1922 , Hamburg was assigned to the North Sea Squadron , with the old battleship Braunschweig and the cruiser Arcona . She remained in the fleet until 1923 , when she was withdrawn from active service for use as a training cruiser for naval cadets . She served in this capacity from 1924 to 1927 ; she remained in the Reichsmarine inventory until she was stricken from the naval register on 31 March 1931 . Promoted to Kapitän zur See , Lützow again served as her commander form 27 September 1924 to 2 May 1925 . She was again used as a barracks ship for submarine crews starting in 1936 by the Kriegsmarine , this time in Kiel . She continued in this duty until 1944 , when the Kriegsmarine decided to break her up for scrap . She was towed to her namesake city on 7 July 1944 for dismantling , where she was later sunk by British bombers on 27 July . The wreck was raised in 1949 and ultimately broken up in 1956 . 
