President Bush's last trip to Iraq was kept secret until he arrived at a U.S. military base. Eight hours later he left, after Iraq's leaders traveled to meet him there.

In sharp contrast, President Mahmoud Ahmadinejad's visit — the first ever by an Iranian leader to Iraq — was announced in advance. He plans to spend the night here, and Iranian TV will broadcast his departure ceremony live.

Once considered Iraq's archenemy, Iran is now cozy with Baghdad's Shiite-led government and eager to show off Tehran's rising influence as debate rages in the U.S. over how quickly to leave.

Ahmadinejad was to arrive Sunday morning at Baghdad's airport and head to Iraqi President Jalal Talabani's headquarters, located right across the Tigris River from the mammoth new U.S. Embassy in the fortified Green Zone.

Ahmadinejad sought to reassure Iraqis ahead of the trip by disputing U.S. accusations that Iran is meddling in Iraqi affairs and fueling violence among Shiite militias.

"Iran has no need to intervene in Iraq. It is friendly to all groups in Iraq. Isn't it ridiculous that those who have deployed 160,000 troops in Iraq accuse us of intervening there?" the Iranian state-run news agency, IRNA, quoted Ahmadinejad as saying.

During the two-day visit, Ahmadinejad is scheduled to meet with Talabani and Prime Minister Nouri al-Maliki — both Shiites who have made official visits to Iran since taking office.

The trip symbolically serves several purposes for Iran. Ahmadinejad wants to highlight Shiite-dominated Iran's influence but at the same time show that Iran is not a bully, analysts say.

He also may be trying to bolster his support back home ahead of parliamentary elections later this month that are seen as referendum on the Iranian president. Ahmadinejad has come under criticism from all sides in Iran for spending too much time on anti-Western rhetoric and not enough on economic problems plaguing the country.

Jon Alterman, head of the Middle East program at Washington's Center for Strategic and International Studies, said the visit sends a "clear message to Iraqis that the Iranian influence in the country is significant and enduring."

But at the same time, "he doesn't want to threaten the Iraqis. He doesn't want to threaten Gulf states who fear that Iraq will be an Iranian satellite. He has a thin line to walk," he said.

The U.S. has tried to downplay Ahmadinejad's visit, saying it welcomed Iran's stated policy of promoting stability but had not seen any evidence. U.S. officials would not discuss any possible interaction with him, and Talabani's personal guards were reportedly going to provide security for Ahmadinejad and his delegation.

But the visit comes as U.S. officials have sharpened their rhetoric against Iran in recent weeks. Last month, Lt. Gen. Ray Odierno, who was the No. 2 U.S. military chief in Iraq, warned that Tehran wants to keep Iraq's government weak to block any challenges to Iranian influence.

There is concern in the United States and in Sunni-dominated Arab countries about a growing Iranian dominance in Iraq. The United States has accused Iran of training and supplying Shiite militia fighters in Iraq with weapons and sophisticated explosives designed specifically to kill American tanks and armored vehicles. Iran denies the accusations.

Washington and Tehran have not had diplomatic relations since the 1979 Islamic Revolution led to the taking of hostages at the U.S. Embassy in Tehran. Since Ahmadinejad was elected president in fall 2005, the hostility has only grown over Iran's controversial nuclear program.

Envoys from the two countries have met three times in Baghdad over the past year to discuss Iraq's security, although Iran postponed a fourth round last month without giving a reason. Ahmadinejad stressed Saturday that the talks were useful.

"The outcome of (Iran-U.S.) talks have helped stabilize conditions in Iraq a lot," IRNA quoted Ahmadinejad as telling Iraqi journalists in Tehran.

Falah Shanshal, an Iraqi Shiite lawmaker allied with radical Shiite cleric Muqtada al-Sadr, said he was hopeful Ahmadinejad's visit will help solve some of Iraq's security problems.

"Iran is a neighboring country and opening a new page of dialogue with it is a step in the right direction." Shanshal said.

Despite the hopeful talk, Iran and Iraq have not always had rosy relations. The two countries were hostile to each other throughout Saddam Hussein's regime and fought a destructive eight-year war after Saddam invaded Iran in 1980. About 1 million people died in the conflict.

But when Saddam's Sunni-dominated regime fell and Iraq's Shiite majority took power after the U.S.-led invasion, long-standing ties between the Shiites of both countries flourished again, though the two neighbors have yet to sign a peace treaty.

Many of Iran's Shiite leaders lived in exile in Iran during Saddam's rule, including al-Maliki, and Talabani, who speaks fluent Farsi, has close ties with Iranian officials.

Iranian ruling clerics also have a history of seeking help here, and Shiite Islam's most revered sites are in Iraq. Ayatollah Ruhollah Khomeini sought refuge for years in the Iraqi holy city of Najaf before he returned to Iran and founded the Islamic Republic in the 1979 revolution.

Not everyone is in Iraq is pleased that Ahmadinejad is coming. Some worry that Iraq had become the battleground between the U.S. and Iran and Tehran's growing influence undermines Baghdad's sovereignty.

On Friday, hundreds of demonstrators marched the streets of Baqouba, 35 miles northeast of Baghdad, chanting anti-Ahmadinejad slogans. Many held banners including one that read: "We condemn visit of terrorist and butcher Ahmadinejad to Iraq."

"We wish that there would be a commitment from the Iranian president personally to cease all kind of interventions in Iraq's security and political affairs," Abdul-Karim al-Samaraie, a lawmaker with the main Sunni parliamentary bloc, the Iraqi Accordance Front, told the pan-Arab TV station Al-Jazeera.