In 1807, as Napoleon's army closed in on Lisbon, the Prince Regent João VI of Portugal transferred his court to Brazil and established Rio de Janeiro as the capital of the Portuguese Empire.