International officials gathered in Vienna for last-minute talks on Iran’s nuclear program this weekend, an initiative that will help define President Barack Obama’s foreign-policy legacy and shape efforts to stabilize the Middle East, said U.S., European and Arab officials. With a Monday deadline looming, either success or failure of the talks would have fateful implications for Washington’s ties to the Middle East and for the potential spread of atomic arms in the region. The third and what diplomats say is the most likely outcome—an extension of talks—would prolong uncertainty over the conflict between Iran and the West. Mr. Obama, since taking office in 2009, has focused his efforts on the 35-year-old U.S. standoff with Iran as on any other international issue, these officials said.