MANAGUA, Nicaragua – Iran's hard line President Mahmoud Ahmadinejad, apparently believing there is strength in numbers, is forging an alliance with a new band of Latin American leftist leaders in an attempt to add fuel to his already fiery anti-American rhetoric.

Ahmadinejad, in Ecuador on Monday for the swearing in ceremony President Rafael Correa, took a swipe at the U.S., accusing the Bush administration of trying to hide its failures in Iraq by accusing Iran of funding and providing aid to insurgents there.

Earlier, the Iranian president was in Managua, Nicaragua to congratulate new President Daniel Ortega, once one of Central America's staunchest anti-American leaders. Ahmadinejad also met Saturday with Venezuelan leader Hugo Chavez, after which both men pledged to put up a united front against the U.S.

Ahmadinejad, who also met with Bolivian leader Evo Morales, an outspoken critic of President Bush, said the administration's "attitude won't solve their problems" in Iraq, and he accused the U.S. of ignoring the Iraqi people.

Ortega, who fought off a U.S.-backed insurgency during his first government in the 1980s, took a less confrontational position with Ahmadinejad, instead talking about how the Iranian leader will help the developing world.

"We are conspiring against hunger, poverty and misery," Ortega said.

Iran and Nicaragua said they would open embassies in each other's capitals, strengthening ties between two countries that have had little interaction yet share long and troubled histories with the U.S.

The paths of Nicaragua and Iran crossed in the 1980s during the Iran-Contra affair, in which the U.S. secretly sold arms to Iran to free American hostages, then used some of the proceeds to back Contra rebels fighting to overthrow Ortega.

But that was long forgotten on Sunday, when the two countries signed a development agreement largely targeting Nicaragua's economic and infrastructure problems. It called for the construction of dams and homes, and factories building everything from buses to bicycles. They also agreed to establish programs to improve drinking water, ports and the fishing industry.

Ahmadinejad spent much of his time lashing out at the United States.

During a visit to a trash-strewn neighborhood in the capital of Managua, he told hundreds of Nicaragua's poor: "The imperialists don't like us to help you progress and develop. They don't like us to get rid of poverty and unite people. But the whole world knows that Nicaragua and Iran are together."

Ortega has vowed to maintain relations with Washington and build a more moderate administration than his turbulent, Soviet-allied government of the 1980s. But, setting the stage for a careful balancing act, he has spent his first four days in office heavily courting three of Washington's most outspoken critics: Venezuela, Iran and Bolivia. Chavez promised millions of dollars in aid and support on Thursday, and Iran followed its lead.

Iran has long had close relations with Cuba and Venezuela. But the rising number of leftist leaders in Latin America and their growing frustration with Washington have given Iran an opportunity to expand its influence here.

"Our two countries have common interests, enemies and goals," Ahmadinejad said of Nicaragua. "We may be far apart, but we are close in heart."

Nicaraguans welcomed the Iranian leader, cheering his caravan as it passed through the capital and hoisting placards with Ahmadinejad's photo.

"We just want help for our country, and Iran has money," said Rafaela Morales, a 53-year-old first-grade teacher.

Correa, meanwhile, a tall, charismatic political outsider, took the oath of office in Ecuador's Congress and strapped on the red, yellow and blue presidential sash, smiling broadly and waving to cheering supporters on the floor and in the galleries.

He became the eighth president in the last decade in a nation marked by chronic political stability since it returned to democracy in 1979.

Correa, 43, won a November election runoff as a charismatic outsider who pledged to lead a "citizens' revolution" to make the country's democracy responsive to its poor majority.

Correa has rejected a free trade pact with the U.S., saying it would hurt Ecuador's farmers. And he has said he will not extend the U.S. military's use of the Manta air base on the Pacific coast for drug surveillance flights when a treaty expires in 2009.

Correa's view that Ecuador's democratic system benefits parties, not people, attracted voters disgusted with the corruption and greed of the political elite. More than 60 percent of Ecuadorians live in poverty.

"This democracy is the property of 13 million Ecuadorians, not a bunch of caudillos, not a group of political mafias," Correa said recently.

But some Ecuadorians worry that Correa's real goal is to consolidate political power in the presidency as Chavez and Morales have done. They say he has shown early signs of not respecting the opinions of his political opponents, even moderate ones.

"He is leaving no room to negotiate, to reach an understanding," said Benjamin Ortiz, head of a Quito think tank. "He wants to steamroll over everyone."