After years of Justice Department efforts to bring the WikiLeaks founder to the United States to stand trial, the near-collapse of the case in a British court sent prosecutors hurtling toward a plea deal.