During the imperial period, the Maranhão region, which exported cotton, suffered a severe economic crisis because of competition with the increasingly-productive United States.
A political power dispute arose in the heart of the elite class, which was reflected in Maranhão by the opposition of liberals (bem-te-vis) and conservatives (cabanos).
The event that began the revolt was the detention of the brother of rancher Raimundo Gomes from the ranch of his father, Inácio Mendes, a contingent of the National Guard, invaded the municipal jail and freed him, in December 1838.
Afterward, Gomes, with the support of Cosme Bento, an ex-slave with a force of 3,000 escaped Africans, and Manuel Francisco dos Anjos Ferreira, called the balaio ("basket") because he was a basketmaker, spread the revolt across the interior of Maranhão, conquering the province's second city in importance, Caxias, and going on to Piauí.
The imperial government sent troops under the command of Colonel Luís Alves de Lima e Silva and made him the president of the province.