US top lawyer leaving office amid clash with Trump