In the early 20th century, Bessarabia briefly gained independence from Russia as the Moldavian Democratic Republic. It entered a union with the Kingdom of Romania, with whom it shares the same language and ethnicity in 1918 and was ceded by Romania to the Soviet Union in 1940. This led to the establishment of the Moldavian Soviet Socialist Republic.