Republican presidential candidate Ted Cruz (Tex.) slammed the Obama administration over the conditions surrounding the prisoner agreement that led to the release of five Americans who were being held by Iran.

“We’re all very grateful … but at the same time this deal is a very problematic deal, and it represents a pattern we’ve seen in the Obama administration over and over again of negotiating with terrorists,” Cruz said in an appearance on “Fox News Sunday.”

Cruz likened the deal with a 2014 prisoner swap that led to the release of Sgt. Bowe Bergdahl, an alleged military deserter, in exchange for five detainees at Guantanamo Bay, Cuba.

“I think it's a very dangerous precedent because the result of this — every bad actor on Earth has been told: 'Go capture an American.' If you want to get terrorists out of jail, capture an American and President Obama is in the let's-make-a-deal business,” the senator said.

Speaking in Milford, N.H., later in the day, Cruz said as part of the agreement the United States released "seven terrorists who have been helping Iran acquire nuclear technology, promising not to prosecute another 14 terrorists. That’s 21 terrorists altogether. It sadly continues the pattern we’ve seen from this administration," he said.

President Obama actually offered clemency to seven Iranians charged with violating U.S. trade sanctions against Iran and dismissed charges against 14 other Iranians, all outside the United States.

Cruz, on Fox, blamed the president’s foreign policy for the brief detention of U.S. Navy crew members by Iran last week, saying that Obama has weakened perceptions of American strength abroad.

Host Chris Wallace pressed Cruz on his bombastic military rhetoric, pointing out his comment during Thursday night’s sixth GOP presidential debate that “any country that makes U.S. service members get on their knees … will feel the full force and fury of the United States.”

Wallace noted that the sailors were released within 14 hours of their detention and asked Cruz whether he would have still employed “the full force and fury” of the U.S. military in such a situation.

“They were released in 14 hours, but the only reason they were seized is because of the weakness of Barack Obama,” Cruz responded.

Katie Zezima in Milford, N.H., contributed to this report.