Iran will make the United States "regret" its detention of five Iranian officials in Iraq, Foreign Minister Manouchehr Mottaki said Tuesday.

Mottaki was referring to five Iranian officials detained in the northern Iraqi city of Irbil by U.S. troops in January, who still remain in U.S. custody. The U.S. military has said they are suspected of links to a network supplying arms to Iraqi insurgents — an accusation that Iran has denied.

"We will make the Americans regret their ugly and illegal act," Mottaki was quoted by the official IRNA news agency as saying. He didn't elaborate on how Iran will make Washington regret the action.

"We warn American officials to free our diplomats as soon as possible," Mottaki said.

• Monitor the nuclear showdown in FOXNews.com's Iran Center.

However, Mottaki added that Iran was still willing to continue direct talks with the United States on Iraq, which began first last month in Baghdad and which broke a 27-year diplomatic freeze between the two foes.

The ambassador-level talks were the first formal, scheduled meeting between Iranian and American government officials since the United States broke diplomatic relations with Tehran after the 1979 Islamic Revolution and the seizure of the U.S. Embassy.

A second round of talks was expected later this month, but recent bitter U.S.-Iran exchanges have thrown that new round into doubt.

Mottaki said Iran "will take positively the request of the Iraqi government on the continuation of talks," providing the Americans "change their policies toward solving the problem in Iraq — of which they are a part themselves."

Iraq's ambassador to Baghdad, Hasan Kazemi Qomi, who represented Iran at the May talks, said the issue of the "freedom of the diplomats" would be on the agenda of future Iran-U.S. talks.

"One of the subjects for possible dialogue between Iran and the United States will be the release of five Iranian diplomats," IRNA quoted Qomi as saying.

Iran has claimed the five detained Iranians were diplomats and that the building the U.S. troops occupied during the raid that led to the arrests was an Iranian liaison office.

Visit FOXNews.com's Iran Center for complete coverage.

Tehran also said the five were the guests of the Iraqi government and has demanded their release. Iraqi government officials have also called for their release, along with compensation for damages.

Unconfirmed reports say the five included the operations chief and other members of Iran's elite Quds Force, which is accused of arming and training Iraqi militants.

The five have not been charged with a crime. The United States has allowed the International Committee of the Red Cross to visit the men but has so far not allowed Iranian representatives to visit them.

Mottaki said Iran will send a formal letter to the U.N. Secretary General Ban Ki-moon within the next few days to protest inaction by the Security Council and delays in taking up the issue of the five Iranians' detention.

Iran, meanwhile, has detained four Iranian-Americans while visiting family members in Iran or working here, in a case that has further riled relations between the two countries.

A judicial spokesman, Ali Reza Jamshidi, said Tuesday that a judge will decide within the next few days whether to indict the four with endangering national security or free them.

The families, colleagues and employers of the detained — as well as U.S. officials — have denied the allegations.

The four include Haleh Esfandiari, director of the Middle East program at the Woodrow Wilson International Center for Scholars, who was jailed in Iran in early May. The others are Kian Tajbakhsh, an urban planning consultant with George Soros' Open Society Institute; Parnaz Azima, a journalist who works for the U.S.-funded Radio Farda; and Ali Shakeri, a founding board member of the University of California, Irvine, Center for Citizen Peacebuilding.

Last month, Tehran said it uncovered spy rings organized by the United States and its Western allies on Iranian soil.