Agustín de Iturbide
After the dissolution of the Courts, Castillo moved to Mexico, where he represented Costa Rica in the Constituent Congress of 1822. Afterwards he was a member of the Council of State of Emperor Agustín I (Agustín de Iturbide).