President Obama on Sunday defended his historic nuclear accord with Iran as proof that “smart, patient and disciplined” diplomacy can improve relations with a longtime foe, even as his administration announced new sanctions related to Tehran’s ballistic-missile program.

His declaration followed the lifting of many of the harshest international economic sanctions against Iran and confirmation that Iranian authorities had freed five imprisoned Americans.

The president’s remarks Sunday at the White House capped a dramatic two-day stretch that highlighted the complex and uncertain nature of the United States’ new relationship with one of its oldest and most determined enemies.

Obama’s critics have pilloried the nuclear deal, casting it as a capitulation to Iran’s ruling clerics and evidence of the president’s weakness on the world stage. Obama discussed the deal in a tone more sober than celebratory and acknowledged that “profound differences” remain between the two countries.

“The United States has never been afraid to pursue diplomacy with our adversaries,” he said, citing the examples of past presidents Franklin D. Roosevelt, John F. Kennedy and Ronald Reagan.

He spoke directly to young Iranians, holding out hope that his administration’s milestone foreign policy achievement could open up a pathway to a broader accord between two longtime foes.

“We have a rare chance to pursue a new path – a different, better future that delivers progress for both our people and the wider world” he said. “That’s the opportunity for the Iranian people. We need to take advantage of that.”

Even as Obama spoke optimistically of a new era, there were reminders that the relationship between the United States and Iran remains dangerous.

Once the flight with the former prisoners was on its way, the administration announced new sanctions related to participation in Iran’s ballistic-missile program.

The measures apply to only 11 individuals and companies and are separate from the international sanctions related to Iran’s nuclear program that were lifted Saturday.

Iran’s effort to develop ballistic missiles capable of delivering a nuclear warhead “poses a significant threat to regional and global security, and it will continue to be subject to international sanctions,” said Adam Szubin, the acting undersecretary for terrorism and financial intelligence in the Treasury Department. Some in Congress have criticized Obama for not moving more swiftly to sanction Iran for its missile violations.

Obama highlighted the ongoing tensions between Iran and the United States. “We remain steadfast in opposing Iran’s destabilizing behavior elsewhere,” Obama said, “including its threats against Israel and our Gulf partners, and its support for violent proxies in places like Syria and Yemen.”

He also spoke of Robert Levinson, an American who has been missing in Iran for eight years. Levinson’s whereabouts are not known, and it’s unclear whether he is still alive. A former FBI agent, Levinson was sent to Iran by CIA officials who were not authorized to manage overseas operations.

Obama said Iran has agreed to “deepen coordination” as the United States works to find Levinson and reunite him with his wife and children. “We will never forget about Bob,” Obama said, adding that “we will not rest until their family is whole again.”

SEPARATE NEGOTIATIONS

The nuclear agreement and the release of the American prisoners were negotiated separately to ensure that the detainees were not used as leverage, U.S. officials said. But the completion of the nuclear deal last summer helped accelerate the talks about the prisoners, which loomed in the background of the negotiations.

Three of the American prisoners leaving Iran – Jason Rezaian, a correspondent for The Washington Post; Saeed Abedini, an evangelical pastor; and Amir Hekmati, a former Marine – arrived in Germany on Sunday afternoon, where they received medical attention at a U.S. military hospital. A fourth prisoner, student Matt Trevithick, was released and left the country separately.

A fifth American, Nosratollah Khosravi-Roodsari, was also released but chose to remain in Iran.

The Americans were freed in exchange for U.S. clemency in the cases of seven Iranians charged or imprisoned over sanctions violations, and the dismissal of outstanding charges against 14 Iranians outside the United States. At least five of the Iranians granted pardons or sentence commutations intend to stay in the United States, their attorneys said.

Iran confirmed the release of the American detainees just hours before diplomats in Vienna announced that Iran had fulfilled its promises under the nuclear accord.

The accord frees Iran from crippling sanctions and potentially offers a pathway for ending the country’s decades-long economic and diplomatic isolation.

The United States also agreed to pay Iran $1.7 billion to settle a 35-year-old claim on payments for military equipment the United States refused to deliver after the 1979 revolution and hostage crisis in Tehran.

The money has been tied up in a trust fund and in litigation at the Iran-U.S. Claims Tribunal in the Hague. U.S. officials cast the settlement as a less-risky alternative to fighting it out with Iran in court, where the United States could have been forced to pay billions more in penalties.

‘A LOT BETTER THAN I WAS’

Obama waited to speak Sunday until after the American prisoners held by Iran had cleared Iranian airspace.

After the plane arrived in Germany, Obama telephoned Rezaian’s brother, Ali Rezaian, at Landstuhl medical center. In a call that lasted about two minutes, Obama told Ali Rezaian that his brother’s detention had lasted “too long” and that he hoped they would be able to meet soon.

Rezaian and the other Americans were moved directly into the hospital for medical checks. Ali Rezaian met with his mother, Mary, and Rezaian’s wife, Yeganeh Salehi, who had left Tehran on the plane with Rezaian and two of the other freed Americans.

Martin Baron, executive editor of The Post, and Douglas Jehl, the foreign editor, also met briefly with Salehi and Mary Rezaian and spoke briefly on the phone with Rezaian, who was calling from the hospital.

Asked how he was doing, Rezaian told The Post’s editors, “I’m a hell of a lot better than I was 48 hours ago.”

He said he found escape in the fiction he was allowed to read, and Sunday he was avidly reading whatever he wanted, including stories about his captivity and release. He said it was strange to see himself being talked about so much, and the two Post editors replied that they “had been talking about him for 545 days.”

Obama had been harshly criticized for not making the prisoners’ release a precondition of the nuclear accord, and their freedom offered the president a measure of vindication.

In the White House, Obama read off each of their names and offered words of praise for their work in Iran. He described Rezaian as a “courageous journalist” who “embodies the brave spirit that gives life to the freedom of the press.”

Saeed Abedini, a pastor from Idaho held for more than three years, had displayed “unyielding faith” that had inspired people around the world to fight for religious freedom, Obama said.

– The Associated Press contributed to this report