Napoleon consolidated power in France by becoming the first consul and controlling the executive and legislative branches. He established the Napoleonic Code, Bank of France, and expanded public education. Napoleon crowned himself emperor and expanded French territory through military victories, though he eventually faced setbacks from British naval power and inspired nationalism in other countries. After multiple campaigns, the allies defeated Napoleon and restored the French monarchy under King Louis XVIII.