 In 1808 the Portuguese royal family and most of the aristocracy in the Portuguese capital Lisbon fled Portugal ahead of Napoleon's invasion.The Portuguese capital was temporarily transferred from Europe to Rio de Janeiro.The city remained the capital after the independence of Brazil in 1822 and after the abolition of the monarchy in 1889.