The Napoleonic invasion of Portugal had consequences for the Portuguese monarchy. With the aid of the British navy, the Portuguese royal family was evacuated to Brazil, its most important colony. Even though Napoleon had been defeated, the royal court remained in Brazil. The Liberal Revolution of 1820 forced the return of the royal family to Portugal. The terms by which the restored king was to rule was a constitutional monarchy under the Constitution of Portugal. Brazil declared its independence of Portugal in 1822, and became a monarchy.