BAGHDAD - U.S. Ambassador Ryan Crocker on Sunday accused Iran of trying to interfere with a new security pact between Iraq and the United States, and said Americans need to view Iraq with "a sense of strategic patience" because the stakes in the region are so high.

The 37-year veteran diplomat, interviewed by The Associated Press at his embassy in Baghdad, is in the middle of tough negotiations with Iraqi officials to define the basis for a continuing American military presence in the country beyond the end of this year.

The talks hit an impasse recently and are taking place against a backdrop of increasing calls in the United States for a U.S. withdrawal and declining interest in the war itself from many members of the American public.

Crocker struck an emotional note in discussing the recent accomplishments in Iraq, including a sharp decline in violence across much of the country and some preliminary steps toward political reconciliation, such as last week's agreement to schedule provincial elections by Jan. 31.

"All Americans should be and are proud of the achievements in Iraq and the American role in bringing about the change," he said. "Iraq is in a far, far better place than it was say 18 months ago."

However, he warned, those gains could be in jeopardy if U.S. interest in the country is allowed to flag. "So I think what Americans need going forward is a sense of strategic patience," he said.

"If we decide we are tired of it, if we decide we don't want to do it anymore and that it is time to turn our attention to other things, this could all go the other way," Crocker warned. "And it is certainly my sense as someone who has served in the Middle East for the better part of three decades, that you would pay a major long-term price."

He suggested it could be seen as a repeat of the U.S. withdrawal from Lebanon in the early 1980s, a move that led countries like Iran and Syria to draw assumptions about U.S. lack of resolve and to embrace an attitude of defiance. "These kinds of actions have profound and very far-reaching consequences," he said.

The talks on the military pact have hit an impasse recently over U.S. insistence on retaining sole legal jurisdiction over American troops and differences over a schedule for the departure of the U.S. military. Iraqi officials have said that they want all foreign troops out by the end of 2011.

Crocker, 59, who became ambassador in March 2007 and who is expected to leave his post around the end of the Bush administration, is one of the most experienced diplomats in the Middle East. He has served as ambassador in Lebanon, Syria and Kuwait, and was ambassador to Pakistan before his appointment to Iraq.

He said it is becoming obvious that Iran wants the current negotiations to fail.

"The evidence is pretty clear," said the ambassador. "It is the stream of public statements coming out of Tehran, political and clerical figures, all criticizing the agreement. So they are being very open about their interference."

In spite of Iran's insistence to the contrary, Crocker said Iran is showing a "fundamental desire to oppose the development of a fully secure and stable Iraq. I think they would like to keep Iraq off balance as a way of being able to control events here to the satisfaction of Tehran."

The negotiations for a long-term security agreement are being carried out with the government against the deadline of an expiring United Nations Security Council resolution at the end of this year that provides the legal basis for more than 140,000 U.S. forces in the country.

If and when an agreement is reacted, it still must be ratified by the Iraqi parliament, where it faces strong controversy.

Crocker said he is not worried that time is running out. There are still three months for discussions, he said, and the Iraqi parliament has been able to deal with complex issues quickly when it has to.

If the talks fail, the United States would have to go back to the United Nations to seek an extension of its mandate to be in Iraq, a potentially difficult move diplomatically.

Crocker said the Iraqi government itself is opposing Iranian meddling.

He credited Prime Minister Nouri al-Maliki for the decision in the spring to challenge the Shiite Mahdi Army militia with forces of the national army.

Crocker said that move was "strategically very, very important" and "a statement that Iraq is not going to tolerate illegal militia forces that challenge the state, whoever they are and whoever is behind them."

"With the improvement of conditions in Iraq regional powers are taking a new look at Iraq ... but also at the U.S.," he said. "And again I think that what happens going forward is going to have a profound effect on how the U.S. is perceived in this region and beyond."

"If we are seen as the catalyst that does produce a stable, secure democratic Iraq that never again threatens its own people or its neighbors, we will be seen as a power that came in and produced a fundamentally positive shift in this region."