He had previously served in the government as agricultural minister , president of the national electoral commission and president of the constitutional council .