Castro Barros was elected to represent La Rioja in the 1813 Assembly replacing Ugarteche.
In 1815, he was elected to the Tucumán Congress and served as president in May 1816 for the appointment of Juan Martín de Pueyrredón as Supreme Director. For the declaration on 9 July, he led the Tedeum mass that was celebrated to give thanks. He supported an Incanconstitutional monarchy.
Later Castro Barros became rector of the University of Córdoba on three occasions and founded several primary schools. He lived in exile in the Banda Oriental from 1833 and then from 1841 in Chile, where he was rector of the Universidad de Chile.
A museum dedicated to Castro Barros is located in his birthplace, Chuquis.