But his career was nearly cut short when the C.I.A. inspector general reprimanded him in 1997 for a " remarkable lack of judgment " after he intervened to stop jailhouse beatings by guards of a childhood friend arrested on drug charges in the Dominican Republic .