The program began with leaders in the grip of an alluring idea: They could get tough in terrorist without risking legal trouble by adopting a set of methods used on Americans during military training.