The flag of Brazil consists of green with a yellow diamond in the center bearing a blue globe and 27 white stars. The globe represents the sky over Rio de Janeiro on the day the republic was declared. The number of stars corresponds to Brazil's 26 states and the federal district. Brazil gained a large territory through treaties with Spain and Portugal in the 15th century and the Iberian Union of 1580-1640. The country transitioned from a Portuguese colony to an independent empire in 1822 and a republic in 1889 without civil war, due to the influence of Emperor Pedro II. Brazil has a federal presidential representative democratic republic government with 26 states and a federal district.