Secretary of State Condoleezza Rice pressed Iraqi leaders Thursday to agree quickly to a U.S.-Iraq security deal that outlines the withdrawal of American troops.

Flying into Baghdad on an unannounced trip, Rice said the two sides were nearing an agreement after months of painstaking negotiations but stressed there were still unresolved issues, including when U.S. soldiers will leave and what their operations will consist of until then.

"The negotiators have taken this very, very far," she told reporters aboard her plane. "But there is no reason to believe that there is an agreement yet."

"There are still issues concerning exactly how our forces operate," Rice said, adding that "the agreement rests on aspirational timelines."

Her comments dampened speculation that agreement might be reached while she is in Baghdad on a several-hour visit, her first to Iraq since March, after U.S. and Iraqi officials said Wednesday that a draft document was done and awaiting approval from political leaders.

Rice said it was "very premature" to conclude the agreement had been finalized. The United States had hoped to seal the deal, which will replace the U.N. mandate for international forces in Iraq that expires Dec. 31, by the end of last month.

Rice declined to talk about specific gaps, but U.S. officials said more work is needed to reach agreements on a timeline for U.S. troop withdrawals, immunity for U.S. troops and the handling of Iraqi prisoners.

One senior official said Rice would be pushing Iraqi Prime Minister Nouri al-Maliki hard to accept.

"Ultimately the prime minister has to make the call on moving forward," Rice said. She described her visit as "a chance for me to meet with the prime minister and see what we can do from Washington to get to closure."

One official close to al-Maliki said Wednesday that he objected to parts of the text, including the immunity provision. Another Iraqi official said al-Maliki had gone through the text personally and made notes with objections to some undisclosed points. Both officials spoke on condition of anonymity because of the sensitivity of the issue.

Iraqi and American officials told The Associated Press on Wednesday that negotiators had completed a draft agreement that extends the legal basis for U.S. troops to remain in Iraq beyond the end of this year, while calling for them to move out of Iraqi cities as soon as June 30.

A senior U.S. military official in Washington said the deal is acceptable to the U.S. side, subject to formal approval by President Bush. It also requires approval by Iraqi leaders, and some members of Iraq's Cabinet oppose some provisions.

Also completed is a companion draft document, known as a strategic framework agreement, spelling out in broad terms the political, security and economic relationships between Iraq and the United States, the senior military official said. The official discussed the draft accords on condition that he not be identified by name because the deals have not been publicly announced and are not final.

In addition to spelling out that U.S. troops would move out of Iraqi cities by next summer, the Iraqi government has pushed for a specific date — most likely the end of 2011 — by which all U.S. forces would depart the country. In the meantime, the U.S. troops would be positioned on bases in other parts of the country to make them less visible while still being able to assist Iraqi forces as needed.

There are now about 140,000 U.S. troops in Iraq.

U.S. officials have resisted committing firmly to a specific date for a final pullout, insisting that it would be wiser to set a target linked to the attainment of certain agreed-upon goals. These goals would reflect not only security improvements but also progress on the political and economic fronts.

It was not clear Wednesday how that has been settled in the draft security accord, which the two governments are referring to as a memorandum of understanding. The draft agreement must be approved by the Iraqi parliament, which is in recess until early next month.

Late Wednesday a second senior U.S. official, speaking on condition of anonymity, said the two sides have come up with a draft agreement that addresses the issue of the timing of future U.S. troop withdrawals, but the official would not say whether the two sides had agreed on 2011 for a final pullout. The official suggested there would be a series of timelines set, linked to conditions on the ground, and that the draft worked out by the negotiators required more talks at higher levels of the two governments.

An Iraqi official who was involved in the protracted negotiations said a compromise had been worked out on the contentious issue of whether to provide U.S. troops immunity from prosecution under Iraqi law, but he did not give details. In Washington, the senior military official said the draft agreement reflects the U.S. position that the United States must retain exclusive legal jurisdiction over its troops in Iraq.