The US and Iranian presidents, Barack Obama and Hassan Rowhani, came agonizingly close to a historic handshake on Tuesday, officials said.
"It got so close that they had chosen the room and ordered some water," said a diplomat with knowledge of talks between the two sides on holding a breakthrough encounter.
Leaders from Iran and the United States have not met since the 1979 Islamic Revolution brought often open hostility to their contacts, particularly over Iran's contested nuclear program.
Obama and Rowhani, who since winning an election in June has said he wants to improve relations, spoke several hours apart at the UN General Assembly on Tuesday. They were never in the same room together.
The United States appears to have taken the lead in pressing for a discussion of just a few minutes.
The two sides discussed a possible meeting, but in the end it was "too complicated," for Iran, said a senior US official.
Rowhani told CNN television in an interview how "preparation" for a meeting was carried out.
"The United States declared its interest in having such a meeting and in principle could have, under certain circumstances, allowed it to happen," he added.
"I believe we didn't have sufficient time to really coordinate the meeting."
Rowhani said that "ice-breaking" was still going ahead. The environment is changing and that has come about as a result of the will of the people of Iran to create a new era of relations," he said.
"We indicated that the two leaders could have had a discussion on the margins if the opportunity presented itself," said a senior US administration official, speaking on condition of anonymity.
"The Iranians got back to us; it was clear that it was too complicated for them to do that at this time given their own dynamic back home," the official added.
The approach for a meeting appears to have been a part of what Obama told the UN assembly would be efforts to "test" Iran on its willingness to improve relations.
And US officials said Obama remained open to a meeting with Iran's top leaders who have often excoriated their US counterparts.
"I think our assessment is while President Rowhani has been elected with a mandate to pursue a more moderate foreign policy towards the West and to pursue negotiations -- in part to achieve sanctions relief -- the issue of the relationship between the United States and Iran is incredibly controversial within Iran," said the senior US official
"I think that from the Iranian side, for them it was just too difficult for them to move forward with that type of encounter at the presidential level, at this juncture."
US Secretary of State John Kerry will meet with Iran's Foreign Minister Mohammad Javad Zarif on Thursday.