 In 1675 the city was attacked by the Ottomans and the Tatars, but king John III Sobieski defeated them on August 24 in what is called the Battle of Lwów.In 1704, during the Great Northern War, the city was captured and pillaged for the first time in its history by the armies of Charles XII of Sweden.In 1772, following the First Partition of Poland, the city was annexed by Austria and became the capital of the Austrian province called the Kingdom of Galicia and Lodomeria as "Lemberg", its Germanic name.