If something is for the best, it may seem bad now but will lead to a better outcome later.
Even though it was hard to move away, it was for the best.