Leaders depart UN facing prospect of a wider Mideast war — but with a blueprint for a better future