The US military in Iraq says it intends to release nine Iranians being held there, including two detained on suspicion of helping Shia militias.
Iran and Kurdish leaders have been trying to improve relations
They were among five Iranians who Tehran insists are diplomats seized in the Kurdish city of Irbil in January.
The announcement came as Iran opened two consulates in northern Iraq to improve ties with the Kurdish region.
Iran's ambassador said the detention of the five men was an "illegal act against Iraqi sovereignty".
The Iranian consulate in Irbil was located in the same building that was raided by the US forces in January.
A US military spokesman said the individuals being released were of "no continuing value, nor do they pose a further threat to Iraqi security".
No details were given about the other seven that the spokesman, Rear Admiral Greg Smith, said would be released "in the near future".
Separately, Rear Adm Smith said five US soldiers were killed in two roadside bomb attacks in Iraq on Monday.
Washington accuses Tehran of training and supplying Shia militias with weapons and military training used against US soldiers in Iraq.
Iran denies the charge and blames continued violence on the US-led invasion of the country in 2003 and the presence of US troops.
Also on Monday, the US military said a mass grave had been discovered north-west of Baghdad, containing 22 bodies.
The grave was found by Iraqi troops on Saturday in the Lake Thar Thar region, during an operation targeting al-Qaeda militants.
The Iraqi authorities are trying to establish the identities of those found in the grave, and the causes of their deaths.