Lengthy immigration detention needed to ensure public safety, federal lawyers argue