he reached the rank of captain in the militias of costa rica