Cairncross, once a close ally of the president, lost favor as he clashed with other officials over AI security.