WASHINGTON (Reuters) - President Barack Obama on Thursday strongly pushed back against criticism that the administration's payment of $400 million in cash to Iran amounted to ransom in exchange for the release of American prisoners.

Iran released the five detainees on Jan. 16 after the United States had agreed to grant clemency to seven Iranians held mostly for sanctions violations and drop charges against 14 Iranians overseas. The payment, which the administration announced the following day, coincided with the lifting of international sanctions against Tehran as part of a historic nuclear deal reached last year.

"We announced these payments in January, many months ago. It wasn't a secret. This wasn't some nefarious deal," Obama said at a press conference at the Pentagon.

At the time, the United States said it had settled a long-standing Iranian claim at the Iran-U.S. Claims Tribunal in The Hague, releasing $400 million in funds frozen since 1981, plus $1.3 billion in interest that was owed to Iran.

The funds were part of a trust fund Iran used before its 1979 Islamic Revolution to buy U.S. military equipment that was tied up for decades in litigation at the tribunal.

The claims, which had dragged on for decades, were resolved in January because the United States and Iran were having diplomatic discussions for the first time in years, thanks to the negotiations over the nuclear deal, Obama said.

"The issue is not so much that it was a coincidence, as it is that we were able to have a direct discussion," he said. "(Secretary of State) John Kerry could meet with the (Iranian) foreign minister, which meant that our ability to clear accounts on a number of different issues at the same time converged."

He said the United States does not pay ransom for hostages and that the money was not linked to the prisoners' release.

"The reason that we had to give cash is precisely because we are so strict in maintaining sanctions and we do not have a banking relationship with Iran," Obama said.

Obama also praised the nuclear deal, saying it had worked exactly as intended. Members of Congress have harshly criticized the deal, which curbs Iran's nuclear program in return for the lifting of sanctions, for granting Iran too much relief and not doing enough to prevent Iran from getting a nuclear weapon.

(Reporting by Jeff Mason and Yeganeh Torbati; Editing by Chris Reese and Richard Chang)