As World War I came to a close, Lithuania declared independence and Latvia formed a provisional government. Estonia had already obtained autonomy from tsarist Russia in 1917, but was subsequently occupied by the German Empire; they fought an independence war against Soviet Russia and Baltic nobility before gaining true independence from 1920 to 1939. Latvia and Lithuanians followed a similar process, until the Latvian War of Independence and Lithuanian Wars of Independence were extinguished in 1920.