In 1821 Agustín Iturbide formed a ruling junta for newly independent Mexico that excluded his prominent fellow revolutionary officers. Near the end of 1821, Iturbide imprisoned several that may have been plotting against him. Among these was Mexico's first president, Guadalupe Victoria.
Victoria was elected to Congress while imprisoned. As his lawyer prepared a defense based on his status as a congressional deputy, two other deputies helped him escape from prison. He stayed in hiding for months waiting for a pardon which never came. Iturbide ordered Santa Anna to detain him, but the order was ignored.
By December 1822 Victoria and Santa Anna were working together to overthrow Iturbide. Their Plan de Casa Mata succeeding in bringing about the emperor's abdication. A triumvirate including Victoria came to power and Victoria's own term of office followed.
Where and for how long was Victoria imprisoned?
Principal source: Guadalupe Victoria: primer presidente de México, Lillian Briseño Senosiain et al, pp. 43-46.