Secretary of State Condoleezza Rice said Monday the United States decided to hold talks with Iran about security in wartorn Iraq because officials believed the timing was right.

"We've had that channel (for talks) for some time, and it seemed like a good time to activate it," Rice told reporters accompanying her here for talks with Russian officials.

She said the idea of the talks came from talks with Iraq's neighboring countries in the region, saying "we all made a commitment there to do what we can to help the Iraqis."

"And one of the most important things is to help the Iraqis is dealing with their border issues, with the flow of foreign fighters and arms across the border," Rice added, "and from our point of view and the coalition's point of view, dealing with the dangerous technologies that are originating in Iran that are putting our soldiers at risk. So this seemed to be a good time to follow up on some of the general commitments that the neighbors took."

The announcement that the United States and Iran would hold the talks represented a historic political turnabout for the two countries with the most influence over Iraq's future.

Expectations of progress remain low, however, with tough issues at stake and mutual suspicions running high. Even as it announced the talks, Iran lashed out at Vice President Dick Cheney's weekend warnings about its nuclear program, saying it would retaliate if the U.S. attacked it.

Yet the two sides said they were setting aside such differences to focus on a narrow issue — Iraq's continued violence and sharp political deterioration.

"The purpose is to try to make sure that the Iranians play a productive role in Iraq," said Gordon Johndroe, the White House's National Security Council spokesman.

Cheney's spokeswoman, Lea Anne McBride, also confirmed the upcoming talks Sunday, saying the vice president supports the move as long as they focus solely on Iraq.

Iran agreed to the talks "after consultation with Iraqi officials, in order to lessen the pain of the Iraqi people, support the Iraqi government and establish security and peace in Iraq," the state-run news agency, IRNA, quoted Foreign Ministry spokesman Mohammad Ali Hosseini as saying.

Iraqi leaders have leaned on the Bush administration to try to cooperate with Iran in the interest of stabilizing their country. Likewise, some Mideast Arab allies of the U.S. — increasingly distrustful of Iraq's Shiite-led government — have pushed for talks with Iran as a way to reduce sectarian tensions in the country and stop attacks against Sunnis.

The decision to talk comes at a critical time of plunging U.S. support for the war and growing pressure from Congress for Iraq's government to make some political progress, or lose U.S. backing. Many critics say the U.S.- and Iraqi-led security push and troop buildup is also struggling.

In March, lower-level U.S. and Iranian diplomats did hold rare, brief talks on the sidelines of a Baghdad gathering. At a follow-up conference a week ago in Egypt, there was a casual chat between the U.S. ambassador to Iraq, Ryan Crocker, and Iran's deputy foreign minister, Abbas Araghchi.

The timing of the upcoming talks in Baghdad was unclear, but Johndroe and Iraq's foreign minister, Hoshyar Zebari, both said they expected them to occur sometime in the next few weeks.

The Baghdad setting will allow for "serious, quiet and focused discussions on the responsibilities and the obligations of all to help stabilize the situation in Iraq," Zebari said.

The U.S. sees Iran as the biggest threat to Iraq's stability, accusing Tehran of supplying Shiite militias with deadly roadside bombs that kill American troops. Iran denies the accusations.