U.S. and Iranian officials met secretly in such out-of-the-way places as Oman, using military planes, side entrances and service elevators to conceal their efforts to lay the ground for Sunday's nuclear agreement.
The contacts, first reported in detail by the Associated Press and later confirmed by U.S. officials and a former Iranian official, helped to bring about a deal that could help to end a decade-long impasse over Iran's suspect nuclear work.
They also illustrate a U.S. desire, dating to the start of U.S. President Barack Obama's administration in January 2009, to explore whether there might be a way to reconcile two nations that have been at odds for more than a third of a century.
After four days of talks, Iran and six world powers - Britain, China, France, Germany, Russia and the United States, known as the P5+1 - clinched an interim deal curbing the Iranian nuclear program in exchange for some sanctions relief.
The path to that pact, however, included a series of secret meetings - personally authorized by Obama - between top U.S. State Department, White House and Iranian government officials this year, a senior U.S. official said.
A former Iranian official confirmed the secret talks and said they took place with the wary approval of Iran's Supreme Leader, Ayatollah Ali Khamenei, who was skeptical of the outcome but agreed to all the meetings to take place.
According to the U.S. official, who spoke on condition of anonymity, key Americans involved in the effort were William Burns, the U.S. deputy secretary of state, and Jake Sullivan, the national security adviser to U.S. Vice President Joe Biden.
The two men, at times with other officials such as White House national security staff member Puneet Talwar, met Iranian officials at least five times this year, the official said.
Burns, Sullivan and technical experts arrived in Muscat, Oman in March on a military plane - a way to preserve secrecy - to meet Iranians, the official added.
The former senior Iranian official, who took part in one of the meetings, said they had the wary endorsement of Khamenei.
"All the meetings with Americans had the (supreme) leader's blessing. The first one was the most difficult one as we had to convince our top authority about the positive outcome of such meetings," said the former senior Iranian official.
"WE TOOK A RISK BUT WE WON"
"The leader gave the green light but was not optimistic about the result," he said. "We took a risk but we won."
The Oman channel itself was nurtured by U.S. Secretary of State John Kerry, who, as chairman of the U.S. Senate Foreign Relations Committee made an unannounced trip to the Gulf state to meet Omani officials.
When Kerry became secretary of state, a job he has held since February 1, it was decided this channel would continue to help feed into the P5+1 talks, and Kerry visited Oman himself in May for talks with Omani officials.
The U.S. outreach accelerated after the inauguration of Hassan Rouhani, a relative moderate, as Iran's president in August, an event that appears to have opened the possibility of easing the long estrangement between the two countries.
The senior U.S. official said that four of the secret U.S.-Iranian meetings took place since Rouhani's August inauguration, a sign that the United States was trying to exploit the opportunity presented by the Iranian official's ascent.
Kerry met Iran's foreign minister at the U.N. General Assembly in September and, soon thereafter, Obama and Rouhani spoke by telephone, marking the highest-level contact between the United States and Iran since the 1979 Islamic Revolution.
Kerry also spoke to the Iranian foreign minister by telephone on October 25 and November 2 - discussions that were not revealed by the State Department at the time.
The United States was so eager to keep the role of Burns and Sullivan secret that it brought them to Geneva twice this month for wider talks between Iran and the major powers but left their names off the official delegation list and made them use hotel side entrances and service elevators to keep the secret.
Asked if the clandestine meetings were instrumental in helping achieve Sunday's nuclear agreement between Iran and the six major powers, the senior U.S. official replied: "Yes."