Answer
When Brazil became a kingdom in 1815, Maria I became Queen of the United Kingdom of Portugal, Brazil and the Algarves. This title combined the existing Kingdom of Portugal with the newly created Kingdom of Brazil. The United Kingdom was a personal union of the two kingdoms, with Maria I ruling both countries. The union lasted until 1822, when Brazil declared independence.