During the French invasion of Portugal by Emperor Napoleon I in 1807, the Portuguese royal family (House of Braganza) fled across the Atlantic Ocean with the help of the British Royal Navy to Brazil, establishing Rio de Janeiro as the de facto capital of Portugal and the Portuguese Empire during the ensuing worldwide Napoleonic Wars (1803–1815). This had the side effect of soon creating within Brazil many of the institutions required to exist as an independent state; most importantly, it freed Brazil to trade with other nations at will.