Honduras declared independence from Spain in 1821, joining the First Mexican Empire, which soon became the United Provinces of Central America. Honduras later joined other variations of Central American federations, until they proved unsuccessful. In 1838, Honduras became an independent republic, though it has since experienced political instability and many rebellions. In the 20th century, Honduras was a point of focus of US produce companies, leading to a rise of banana plantations and other production. This foreign influence led to Honduras taking on a greater role in international politics and conflict, including a border battle with El Salvador. The 21st century brought a crisis including an illegal military coup, according to the UN, in 2009.