Federal court affirms right to regulate ballast water