CARACAS - Iran's Mahmoud Ahmadinejad and Cuba's Raul Castro joined about 30 other heads of state at Friday's funeral for Hugo Chavez in an emotional farewell to the charismatic but divisive Venezuelan leader who changed the face of politics in South America.
Chavez died this week aged 58 after a two-year battle with cancer, devastating millions of mostly poor supporters who loved him for putting the country's vast oil wealth at their service, but giving hope to foes who saw him as a dictator.
A frequent visitor to Caracas and fellow "anti-imperalist," Ahmadinejad received a standing ovation as he took his place in a guard of honor by Chavez's coffin, then broke protocol to touch the casket and clench his fist in a revolutionary salute.
"It's as if the world has come together around Hugo Chavez," said Venezuelan Foreign Minister Elias Jaua.
"His voice and his thoughts reached far beyond our shores."
Chavez's preferred successor and acting president, Nicolas Maduro, laid a replica of the sword of 19th century independence leader Simon Bolivar on top of the coffin, which was draped in the country's red, yellow and blue flag.
A singer in a cowboy hat serenaded the mourners with music from Chavez's birthplace in Venezuela's "llanos" plains.
The late president's body is to be embalmed and shown "for eternity" - similar to how Communist leaders Lenin, Stalin and Mao were treated after their deaths.
His remains will lie in state for an extra seven days to accommodate the millions of Venezuelans who still want to pay their last respects to a man who will be remembered as one of the world's most colorful and controversial populist leaders.
Huge crowds of "Chavistas" gathered from before dawn for the ceremony at a military academy where his body was lying in state. Many were dressed in the red of the ruling Socialist Party, carrying his picture and waving Venezuelan flags.
"I asked God to grant him life, not me," said Leonida Munoz, 73, wearing a T-shirt bearing the image of Chavez's eyes. "He deserves to live more than I do."
She said she had been waiting more than 26 hours to view Chavez's coffin. More than 2 million people have filed past the casket since Wednesday, many sobbing, some saluting, and others crossing themselves.
In Caracas were most of Chavez's highest-profile Latin American friends, such as Ecuadorean President Rafael Correa and Brazil's former leader, Luiz Inacio Lula da Silva.
"Most importantly, he left undefeated," Castro said, referring to Chavez's four presidential election wins, among a string of other ballot victories in his 14-year rule.
"He was invincible. He left victorious and no one can take that away. It is fixed in history."
Celebrity mourners included US civil rights leader Reverend Jesse Jackson, Sr., who led a prayer at the service, Oscar-winning US actor and director Sean Penn, and renowned conductor Gustavo Dudamel.
Dudamel, who heads Venezuela's Simon Bolivar Symphony Orchestra and the Los Angeles Philharmonic, led musicians at the funeral playing classical numbers including the national anthem.
Belarusian President Alexander Lukashenko and Ahmadinejad were among the more controversial figures. Ahmadinejad has caused a storm back home for saying Chavez would be resurrected alongside Jesus Christ and a "hidden" imam who Shi'ite Muslims believe will rise up to bring world peace.
The United States was not sending senior officials.
Former US Representative William Delahunt and US Representative Gregory Meeks were attending, amid speculation of a possible post-Chavez rapprochement between the two ideologically opposed governments.
Jerusalem Post Annual Conference. Buy it now, Special offer. Come meet Israel's top leaders