The German Empire refers to Germany during the Second Reich period from the unification of Germany and proclamation of Wilhelm I as German Emperor on 18 January 1871 to 1918 when it became a federal republic after defeat in World War I and the abdication of the Emperor Wilhelm II. The German Empire consisted of 27 constituent territories (most of them ruled by royal families).