CARACAS At least two dozen heads of state were due to attend Hugo Chavez's funeral on Friday during an outpouring of grief for the charismatic but divisive Venezuelan leader who changed the face of politics in South America.
Chavez died on Tuesday at age 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 opponents who denounced him as a dictator.
Huge crowds of "Chavistas," many carrying his picture or wearing T-shirts bearing the image of his eyes, have swamped the plazas around a military academy where his coffin was carried after being paraded through the streets.
"A thousand thanks for the posthumous tributes to a man who fought for world peace, for unity in Latin America and the Caribbean, and for the democratization of global institutions," Foreign Minister Elias Jaua said.
"The show of love for the president has been incredible."
Chavez's body is to be embalmed and shown "for eternity" at a military museum - similar to how communist leaders Lenin, Stalin and Mao were treated after their deaths.
His remains are to 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.
"All these measures are being taken so that the people can be with their leader forever," Chavez's preferred successor and acting president, Nicolas Maduro, said. Maduro will be sworn in as caretaker president after the funeral on Friday.
More than 2 million people have so far filed past Chavez's coffin behind a red rope at a grandiose military academy, many sobbing, some saluting or crossing themselves.
Among the leaders gathering in Caracas were close allies such as Ecuadorean President Rafael Correa, Brazil's current and former leaders, Dilma Rousseff and Luiz Inacio Lula da Silva, and Cuban President Raul Castro.
"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."
Argentine President Cristina Fernandez, a close friend, was one of the first high-profile mourners to arrive after Chavez's death. She flew home to Buenos Aires on Thursday, local media there said, and will not be attending Friday's funeral.
Iranian President Mahmoud Ahmadinejad was due at the ceremony, as well as a delegation from the United States.
A government source said Chavez slipped into a coma on Monday before dying the following day of respiratory failure. The cancer had spread to his lungs, the source added.
Chavez never said what type of cancer he was suffering, and chose to be mainly treated in Cuba for privacy.
His death paved the way for a new vote in the South American nation that boasts the world's biggest oil reserves. But it is unclear when the election will be held. Many Venezuelans have yet to get past his death and think much about the future.
Watching thousands of people file past en route to see Chavez lying in state, Cesar Mendoza, 28, was selling photos of the late president - shots of him in uniform, before and after cancer, others of him with the Castro brothers.
"I'm a Chavista. ... I do what I do so all the compatriots can have the commander in their house," he said, adding he had sold 400 photos in one day, and more than 400 Venezuelan flags.
The constitution stipulates that an election must be called within 30 days, but politicians say the electoral authorities may not be ready and there has been talk of a possible delay.
Maduro, 50, a former bus driver who became foreign minister and then vice president, looks certain to face opposition leader Henrique Capriles, 40, the centrist governor of Miranda state who lost to Chavez in last October's election.
Opposition sources say the 30 or so political groupings making up the Democratic Unity coalition have again agreed to back Capriles, whose 44 percent vote share in 2012 was the best performance by any candidate against Chavez.
Opposition loyalists blame the late president for creating deep rifts in society with his combative, hectoring style.
"He did more damage to Venezuela than anyone else," said one opposition supporter, Cesar Caballero, 66. "The country is broken in two parts, each hates the other. Chavez did that."
A recent opinion poll gave Maduro a strong lead over Capriles, and Western investors and foreign diplomats are factoring in a probable win for Maduro and a continuation of "Chavista" policies, at least in the short term.
Maduro, who lacks Chavez's man-of-the-people charisma, has pledged to adhere to his late leader's brand of nationalist politics and leftist economic policies.
(Additional reporting by Simon Gardner in Caracas and Rosa Tania in Havana; Editing by Peter Cooney)