1 of 5
Esteban Felix, Associated Press
Nicaragua’s President Daniel Ortega takes the oath of office during his swearing-in ceremony in Managua, Nicaragua, Tuesday Jan. 10, 2012. Ortega starts his third term as president of Nicaragua on Tuesday.

MANAGUA, Nicaragua — Daniel Ortega was sworn in Tuesday for his third 5-year term as president of Nicaragua, shrugging off opposition complaints his re-election was illegal and vowing to govern with moderation.

Presidents from all other Central American nations attended the inauguration, but the most notable visitor was Iranian President Mahmoud Ahmadinejad, who is touring the region to bolster his country's alliances in the U.S. neighborhood at a moment of sharp disputes with Washington.

Ahmadinejad said both Iran and Nicaragua are "on the road to fight for the establishment of security and justice" and referred to Ortega as "my brother president."

Ortega's closest and most financially supportive ally, Venezuelan President Hugo Chavez, attended the ceremony after playing host to Ahmadinejad in Caracas.

"This is part of a unified process that has been set in motion (in Latin America), because only by being united will we truly be free," Chavez said of Ortega's re-election. The comment was apparently a reference to the countries in the region which, like Nicaragua, participate in the Chavez-inspired, left-leaning Bolivarian Alliance.

Ortega took the oath of office in front of about 8,000 people gahtered at Revolution Plaza, the site where Ortega and his ragtag band of Sandinista rebels celebrated the overthrow of dictator Anastasio Somoza in 1979.

Ortega was a socialist firebrand then, and the U.S. government, enmeshed in the Cold War, tried to overthrow him by backing Contra rebels, but he eventually was voted out of office in 1990.

Ortega is still a firm ally of Chavez and Cuba's communist government, but he has worked to maintain ties with Washington. He signed the Central American Free Trade Agreement with the U.S. and has cultivated relations with the Roman Catholic Church and Nicaragua's business sector. He also has boosted his popularity by creating dozens of programs for the poor in a country where more than 40 percent of the people live on less than $2 a day.

Ortega has promised to follow a moderate path in his third term, even though his Sandinista party dominates Nicaragua's legislature.

Still, critics allege he aims to become president for life, using courts and electoral institutions that are stacked with Sandinista appointees. The Supreme Court ruled that Ortega could seek re-election though the country's constitution forbids it.

Despite that controversy, the 66-year-old Ortega won 64 percent of the vote in November, though opposition parties allege that total was inflated by fraud.

Ahmadinejad first visited Nicaragua in 2007, when he promised cooperation in energy and a port development project. But so far the only aid Iran has given the Central American country is a clinic in the capital that cost $1.5 million.