https://en.wikipedia.org/wiki/Transfer_of_Crimea_in_the_Soviet_Union
Prior to being incorporated into the Russian Empire, the Crimean Peninsula was independent under the Crimean Khanate. The Muslim Turkic Crimean Tatars were under the influence of the Ottoman Empire, while also bordering Russian Empire. In 1774, following the Russo-Turkish War of 1768–74, the Russian and Ottoman empires agreed to refrain from interfering with the Crimean Khanate through the Treaty of Küçük Kaynarca. In 1783, following the increasing decline of the Ottoman Empire, the Russian Empire annexed the Crimean Khanate.
Within Russia, the peninsula was transferred between multiple internal administrations. Through its time in the Russian Empire and the Russian SFSR, up to its transfer to the Ukrainian SSR in 1954, Crimea had been administered by 14 administrations.
Throughout its time in the Soviet Union, Crimea underwent a population change. As a result of alleged collaboration with the Germans by Crimean Tatars during World War II, all Crimean Tatars were deported by the Soviet regime and the peninsula was resettled with other peoples, mainly Russians and Ukrainians. Modern experts say that the deportation was part of the Soviet plan to gain access to the Dardanelles and acquire territory in Turkey, where the Tatars had Turkic ethnic kin, or to remove minorities from the Soviet Union's border regions.
Nearly 8,000 Crimean Tatars died during the deportation, and tens of thousands perished subsequently due to the harsh exile conditions. The Crimean Tatar deportation resulted in the abandonment of 80,000 households and 150,000 hectares (360,000 acres) of land.
The autonomous republic without its titled nationality was downgraded to an oblast within the Russian SFSR on 30 June 1945.
On 19 February 1954, the oblast was transferred from the Russian SFSR to the jurisdiction of the Ukrainian SSR, on the basis of "the integral character of the economy, the territorial proximity and the close economic and cultural ties between the Crimea Province and the Ukrainian SSR" and to commemorate the 300th anniversary of Ukraine's union with Russia (also known in the Soviet Union as the Pereiaslav Agreement).
Sevastopol became a closed city due to its importance as the port of the Soviet Black Sea Fleet and was attached to the Crimean Oblast only in 1978.