(CNN) — Hugo Chavez was known to break out into song during his long-winding speeches, and fittingly, traditional Venezuelan llanera music filled the space where his funeral was held.
Chavez, who died Tuesday at age 58, was a polarizing figure in his country. But his followers revered him, and his funeral Friday in Caracas reflected that status.
There were 32 heads of state in attendance, and all of them were called, in groups of eight, to flank the Venezuelan president’s casket and observe a moment of silence as honor guards.
Venezuelan standouts in the arts and sports likewise surrounded the deceased leader.
Chavez left behind a mixed legacy: He is credited with putting the nation’s poor at the center of his policies, but also had an authoritarian streak that garnered criticism from defenders of human rights and press freedom.
The turnout of foreign leaders and thousands of mourners who waited hours for a chance to view Chavez is a testament to the role he played in the country, the Rev. Mario Moronta said.
Venezuelan Vice President Nicolas Maduro, who will be sworn in as interim president later Friday, laid a replica of the sword that South American hero Simon Bolivar used on top of Chavez’s flag-draped casket.
Tributes to Chavez were also paid in Cuba, where the military made a 21-gun salute from the La Cabana Fortress overlooking Havana. Military officers placed roses in front of a picture of Chavez. Venezuela and Cuba maintain close military ties, and Cuba sent hundreds of military and intelligence advisers to aid Chavez while he was president.
Chavez was known for his anti-American rhetoric and allied himself with others at odds with the United States.
Iranian President Mahmoud Ahmadinejad attended and kissed Chavez’s casket.
“He was a dear friend of all nations worldwide,” Ahmadinejad had said upon his arrival in Venezuela. “He was the emotional pillar for all the revolutionary and freedom-seeking people of the region and the world.”
The United States, which doesn’t have an ambassador in Venezuela, was represented at the funeral by the charge d’affaires at its embassy in Caracas, James Derham.
U.S. Rep. Gregory Meeks, D-New York, and former lawmaker William Delahunt of Massachusetts made up the rest of the U.S. delegation.
Hollywood actor and Chavez friend Sean Penn was at the funeral, as was the Rev. Jesse Jackson, who offered a prayer.
“Hugo fed the hungry. He lifted the poor. He raised their hopes. He helped them realize their dreams,” Jackson said.
Maduro, who Chavez had named as his preferred successor before his death, gave a lengthy, impassioned speech that made him emotional at times.
He addressed the view of Chavez as an autocrat and inept leader who left Venezuela worse off than when he assumed power.
“Never has a man, here or anywhere, been lied about so much,” he said.
Chavez was a “true son of Christ” who taught the country love and forgiveness, Maduro said. “That’s why today we say from our hearts, we forgive those who have defamed you.”
Chavez had asked Maduro and other top leaders what they would do when he died, the vice president said.
“He arranged it all for us, and now it is up to us whether we will carry it out or not,” he said.
There was no burial after the funeral, because of an unexpected twist that Maduro announced Thursday.
Chavez will be embalmed “just like Lenin (and) Mao Zedong” and laid to rest at a military museum where generations of Venezuelans can visit.
It is a reminder that Chavez’s image will not soon fade.
“The body of our leader will be embalmed, and it will … be surrounded by crystal glass forever, present forever, and always with his people,” he said on state-run TV.
Chavez died after a long battle with cancer. Thousands of his supporters lined the streets Wednesday in a procession from the military hospital where he died to a military academy where Venezuelans could view him.
As president, Chavez cultivated an image as a protector of the country’s marginalized, and his followers worshiped him with fervor. The turnout at the military academy to view Chavez was so great that the viewing was extended for another seven days.
Chavez first announced his cancer diagnosis in June 2011, but the government never revealed details about his prognosis or specified what kind of cancer he had.