President celebrated the release of five American prisoners from Iran on Monday.

"Today, five innocent Americans who were imprisoned in Iran are finally coming home," Biden said in a statement.

The release came as world leaders gathered in New York this week for the annual high-level meetings of the United Nations General Assembly. Iran's president, Ebrahim Raisi, will be in attendance, as will Biden.

Siamak Namazi, Morad Tahbaz, Emad Sharghi and two unnamed citizens were released Monday as part of a deal that unfroze $6 billion of Iranian money from South Korea to Qatar and led to the release of five Iranians imprisoned in the United States. South Korea owed Iran, but had not paid, the money for oil purchased before the U.S. imposed sanctions.

"For almost eight years I have been dreaming of this day," Namazi, who was imprisoned in 2015, said in a statement following his release.

"My ineffable joy of my forthcoming reunification with my family is laced with sorrow – a painful and deep feeling of guilt for taking my breaths in freedom while so many courageous individuals that I love and admire continue languishing behind those walls," Namazi said.

Read more of CNBC's politics coverage:

Biden thanked the emir of Qatar and the sultan of Oman for their assistance in facilitating the trade. He did not mention the $6 billion, nor did he praise Iranian leaders for their role in the swap. On the contrary, the president announced new sanctions against Iran.

"Today, we are sanctioning former President Mahmoud Ahmadinejad and the Iranian Ministry of Intelligence under the Levinson Act for their involvement in wrongful detentions. And, we will continue to impose costs on Iran for their provocative actions in the region," he said.

The deal received pushback from Republicans who accused Biden of paying a "ransom" that they said would only encourage the taking of more Americans in the future.

"I am always glad when Americans are released from captivity," Sen. Lindsey Graham, R-S.C., , formerly Twitter, when the deal was announced last week. "However, this agreement will entice rogue regimes, like Iran, to take even more Americans hostage. The ayatollah and his henchmen are terrorists and truly represent a terrorist state."

Former president Donald Trump also criticized the deal in a post on his Truth Social, saying "once you pay, you always pay and many more hostages will be taken."

The White House has argued the deal is not equivalent to a ransom because the money, which isn't American tax dollars, was already owed to Iran and would be overseen by Qatar, to be used only for humanitarian purposes.