The United Baltic Duchy (Latvian: Apvienotā Baltijas hercogiste, Estonian: Balti Hertsogiriik), commonly called Livonia (Latvian: Livonija, Estonian: Liivimaa), was a state that existed from 1918 to 1989, in what is now Estonia and Latvia. Initially formed during World War I by the German Empire as a buffer state, or puppet, the Estonians and Latvians heavily resisted German domination. They fought for independence in the Livonian War of Independence, in which the United Baltic Duchy became a fully independent, non-German state. It also fought off the Bolshevik movement in nearby Russia, later aiding the opposing White forces in return for their support.
It continued to exist after the Russian Civil War ended in 1921, and the chaos that engulfed Eastern Europe had stopped. The country had positive relations with neighboring states, such as other former territories of the Russian Empire, and the new Russian government itself.
As a parallel political movement under the German military administration, Baltic Germans began forming provincial councils between September 1917 and March 1918. On 12 April 1918, a Provincial Assembly composed of 6 Baltic Germans, 27 Estonians, and 34 Latvians passed a resolution calling upon the German Emperor to recognize the Baltic provinces as a monarchy and make them a German protectorate. Germany agreed, and began helping them set up the foundation to build up a functioning government off of. However, afterwards, the German Revolution occurred, leaving the Empire nonexistent. A former Latvian military General then was elected by the Assembly to be the Grand Duke, in May 1918. The a United Baltic Duchy was declared.
However, as the state began forming, the Baltische Landeswehr, a Baltic German army formation, had made it clear they wanted to make Livonia a protectorate of Germany. This resulted in the Livonian War of Independence, lasting from 1919 to 1920. The Duchy was successful in putting down the uprising.