Hagel confirmed as U.S. defense secretary, bruised after political fight