U.S. officials said they believe the Iranians, detained in northern Iraq in January 2007, had facilitated attacks on American-led forces but handed them over to the Iraqi government at its request because they were obliged to do so under a U.S.-Iraqi security agreement.
The U.S. State Department said it was concerned their release could present a security threat to American troops in Iraq.
Iraq's foreign minister, Hoshyar Zebari, called the release a "good initiative" that could encourage dialogue between Washington and Tehran, which are longtime foes.
The Iranian Embassy said it expected to receive the Iranians, described by their government as diplomats. Washington believes they are associated with the Quds Force, part of Iran's powerful Revolutionary Guard Corps, and that they trained Iraqi militants.
The carnage within Iraqi borders Thursday was a sign that insurgents remain intent on destabilizing Iraq as the United States shifts its focus to the war in Afghanistan. Attacks are down sharply from past years of war and militants have been driven from many strongholds, but they routinely inflict casualties in Baghdad and northern Iraq, a cauldron of ethnic and sectarian tension.
The most lethal attack Thursday was in the northern city of Tal Afar, where women sat in the street amid torn and bloodied bodies in the aftermath of suicide bombings, wailing and beating their chests in grief. Several men crouched and wept into their hands. Others rushed the wounded to ambulances; some used a bed sheet as a makeshift stretcher.
In a statement on his Web site, Iraqi President Jalal Talabani condemned the attacks and said the "forces of evil and terrorism" were trying in vain to demoralize Iraqi security forces and the civilian population.
Some 130,000 U.S. troops remain in Iraq, but they have a much lower profile and are preparing for a complete pullout by the end of 2011. Iraqi attitudes are mixed, with some rejoicing over the absence of American troops in their streets and a new sense of sovereignty, and others worried that extremists will now have more freedom to operate.
"Our security forces are still weak, with poor intelligence," said Saeed Rahim, a government employee in Baghdad. "Deploying more unqualified troops into the streets does not necessarily lead to better results."
The day's violence began at 6:30 a.m., when a suicide bomber in a police uniform and carrying a radio and a pistol knocked on the door of an investigator in the anti-terrorism police force in Tal Afar. When the officer opened the door, the bomber detonated his explosive belt, killing the officer, his wife and son, said Maj. Gen. Khalid al-Hamadani, police chief of the northern Ninevah province.
As people gathered in the aftermath, another suicide bomber detonated his explosives belt, al-Hamadani said. The coordinated attack killed a total of 38 people and injured 66. Army Brig. Abdul-Rahman Abu Raghef said the first suicide bomber was a local resident who had been jailed for one year on suspicion of terrorism, but was released in an amnesty in June.
A day earlier, car bombs in two Shiite villages near Mosul, another northern Iraqi city, killed 16 civilians and injured more than two dozen.
Haneen Qaddo, a lawmaker representing Shiites in the Mosul region, complained about a "big security vacuum" in the north and said Kurdish forces, known as peshmerga, should withdraw from some areas and allow Iraqi army units to deploy. Tensions between Iraqi Arabs and Kurds, who run a virtual mini-state in part of northern Iraq, are considered a major threat to long-term stability.
Factions are maneuvering for control of Kirkuk, a disputed northern city in an oil-rich area that is seen as a flash point for conflict. Police there said a civilian bystander died in a bomb attack on a police patrol on Thursday.
Insurgents also struck Baghdad on Thursday morning, detonating roadside bombs that killed 13 people and injured dozens. Eight of them died and 30 were injured in coordinated blasts near an outdoor market in the Shiite district of Sadr City, said Maj. Gen. Qassim al-Mousawi, spokesman for the city's operations command center.
Hassan Abdullah, a vegetable salesman, said he heard the first blast and went to see what was happening when a second bomb hidden in trash about 100 yards away exploded. He was taken to a hospital with hand and leg injuries.
In the Karrada district of central Baghdad, one civilian died in a bomb attack on the convoy of Central Bank Gov. Sinan al-Shibibi, a police officer said on condition of anonymity because he was not authorized to speak to the media. The governor was unharmed.
In Washington, State Department spokesman Ian Kelly said the U.S. had to release the Iranians under a U.S.-Iraqi security agreement that took effect in January. Kelly said the release was not part of a deal or prisoner exchange with Tehran.
He described the five Iranians as being "associated with" the Quds force. Kelly said the possibility of the five creating security problems in Iraq was "a big concern."
A senior Iraqi government official said on condition of anonymity that the Americans had advised Iraqi counterparts that the Iranians should leave the country.
Also Thursday, the U.S. military said it was investigating the death of a U.S. soldier who had been found "unresponsive" on a military base.