Deal would end devastating war that has shaken Middle East and world beyond