The United States has imposed sanctions over Iran's ballistic missile testing, even as President Barack Obama hailed the release of five Americans from Tehran's custody and a nuclear deal he hopes will stand among his lasting foreign policy achievements.

Mr Obama pledged to counter vigorously Iran's "destabilising behaviour" across the Middle East even while the US engages with the Islamic republic.

After the Americans had been freed, he announced economic sanctions against 11 individuals and entities following a ballistic missile launch in October.

"We're not going to waver in the defence of our security or that of our allies and partners," he said.

With the sanctions announcement, Mr Obama also sought to counter criticism from Republican politicians and presidential candidates that his actions had appeased a nation that has helped the spread of Islamic extremism.

"It reflects a pattern we've seen in the Obama administration over and over again of negotiating with terrorists and making deals and trades that endanger US safety and security," Texas senator Ted Cruz, a leading Republican presidential contender, said on Fox News Sunday.

"Our enemies now know that if you can capture an American, you can get something meaningful in exchange for it," another Republican candidate, Florida senator Marco Rubio, said on NBC's Meet The Press.

But Mr Obama said he decided that "a strong, confident America could advance our national security by engaging directly with the Iranian government".

Democratic politicians who supported the agreement applauded the sanctions announced by the president. In a joint letter to Mr Obama, five senators said failure to impose the restrictions could encourage Tehran to breach international obligations with impunity.

The Obama administration worked for nearly 14 months behind the scenes to negotiate the prisoner trade. Iran also agreed to work to locate American Robert Levinson, who vanished during a trip to Iran in 2007.

In a reciprocal move, Mr Obama said six Iranian-Americans and one Iranian serving sentences or awaiting trial in the US were being granted clemency. He emphasised that they were not charged with terrorism or any violent offences.

"They're civilians and their release is a one-time gesture to Iran given the unique opportunity offered by this moment and the larger circumstances at play," he said.

Mr Obama said the US and Iran had also resolved a long-standing dispute over money Iran used to buy military equipment from America before the two countries broke ties. Iran will get more than $400 million, plus $1.3 billion in interest.

The White House said its lawyers assessed that the US could have faced a "significantly higher judgment" if the case continued.

"There was no benefit to the US is dragging this out," Mr Obama said.

The president used his Sunday morning statement from the White House to speak directly to the Iranian people, saying: "We have a rare chance to pursue a new path - a different, better future that delivers progress for both our peoples and the wider world."

He said Iran had a vibrant culture that had so much to contribute to the world in commerce, science and the arts, but "your government's threats and actions to destabilise your region have isolated Iran from much of the world".

The Obama administration said it was prepared to test whether additional co-operation with Iran was possible, most notably in resolving the civil war in Syria.

White House officials said later that Iran could play a significant role in resolving the Syrian civil war, but profound differences existed. They said Iran needed to understand the fighting would not be resolved as long as Syrian president Bashar Assad remained in power.

The officials said they knew Iran was not going to dramatically change its actions in the next year or two.

"If Iran does act in a more constructive fashion, it would be a positive development in resolving difficult issues," they said. "If they don't, we will continue to enforce our sanctions and continue to have very strong differences."

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.