The Act of Independence of Central America dissolved the Captaincy General of Guatemala in September 1821, and Nicaragua soon became part of the First Mexican Empire. After the overthrow of the Mexican monarchy in March 1823, Nicaragua joined the newly formed United Provinces of Central America (July 1823), which  later became the Federal Republic of Central America. Nicaragua definitively became an independent republic in 1838.