In this photo taken Jan. 14, 2015, U.S. Secretary of State John Kerry, right, speaks with Iranian Foreign Minister Mohammad Javad Zarif in Geneva, Switzerland. Nuclear talks have resumed in Vienna. (Laurent Gillieron/AP)

The deadline for an agreement in the Iran nuclear talks was officially pushed back by a week on Tuesday as negotiators extended a temporary accord that limits Iran’s nuclear program.

Without the last-minute extension, the interim agreement known as the joint plan of action would have expired at midnight. By announcing a new timeline with just a few hours to spare, the negotiators made official what they have acknowledged privately for days — they could not make the June 30 deadline.

In Washington, President Obama said on Tuesday that any agreement with Iran must be verifiable, and he warned that the United States would “walk away” from one that does not demonstrably block Iran’s path to a nuclear weapon. He also cautioned that “deep-seated” distrust between Washington and Tehran will not vanish quickly.

In a White House news conference with Dilma Rousseff, the visiting Brazilian president, Obama said: “I will walk away from the negotiations if in fact it’s a bad deal. . . . Given past behavior on the part of Iran, that simply can’t be a declaration by Iran and a few inspectors wandering around every once in a while.”

Obama also said the United States would maintain pressure on Iran over Americans being held in Iranian prisons to ensure they receive basic legal protections. The fate of detained Americans, including Washington Post correspondent Jason Rezaian, has come up on the sidelines of the nuclear talks but has not been part of the accord under negotiation.

The seven-day extension was needed “to allow more time for negotiations to reach a long-term solution — a Joint Comprehensive Plan of Action — on the Iran nuclear issue,” said Marie Harf, spokeswoman for the State Department negotiating team.

U.S. and European officials have said no more than a few days are contemplated before they will know whether they have a deal that would place restrictions on Iran’s nuclear program in exchange for lifting some sanctions. The negotiators are believed to be discussing the timetable for removing sanctions and how to manage access to sensitive sites in Iran for international inspectors so they can monitor compliance.

Iran has balked at providing International Atomic Energy Agency (IAEA) inspectors entry to military bases, which is problematic because most of Iran’s nuclear and nuclear-related facilities are at such sites.

There were, however, several signals Tuesday that a deal might be nearing completion.

Iranian Foreign Minister Mohammad Javad Zarif rejoined the talks after a one-day visit to Tehran. He returned with Ali Akbar Salehi, the head of Iran’s Atomic Energy Organization, and Hossein Fereydoun, the younger brother of Iranian President Hassan Rouhani.

Salehi had been a key member of the talks earlier this year, working on technical issues with his fellow nuclear physicist Ernest Moniz, U.S. energy secretary.

Salehi was sidelined by surgery last month and participated only by phone, hampering progress in the talks.

Cliff Kupchan, an Iran analyst with the Eurasia Group, called the Iranian’s return a positive sign. “Salehi has good relations with Supreme Leader Ali Khamenei, and his channel with . . . Moniz was key to achieving the 2 April framework accord,” he said.

In another telling sign that a deal might be within reach, Iran’s supreme leader tweeted his support for the Iranian negotiators.

“I recognize our negotiators as trustworthy, committed, brave and faithful,” he said. Only last week, Khamenei had tweeted a list of several red lines, most of which appeared to contradict the agreement on fundamental principles reached in April in Lausanne, Switzerland. That raised concern that Iran could be backsliding.

One potential roadblock to a deal already appeared to have been overcome.

The Associated Press reported that the IAEA will release a report Wednesday saying Iran has met its commitment to reduce its stockpile of low-enriched uranium to agreed-upon levels. Concerns arose a month ago that Iran might not meet the target level, because it was having problems with a plant it built to convert enriched uranium into a form that would be unsuitable to create fissile material for a nuclear weapon.

William Branigin in Washington contributed to this report.