Trump nominee confirmed as US attorney-general after bitter battle