After four years of hostilities in World War I from 1914 to 1918 with heavy losses, Germany was exhausted and sued for peace under desperate circumstances. Awareness of imminent defeat sparked revolution, the abdication of Kaiser Wilhelm II, Germany surrendered, and the Weimar Republic was proclaimed on 9 November 1918.