Venezuelans have paid an emotional farewell to the late President Hugo Chavez at his state funeral in Caracas.
Vice-President Nicolas Maduro told mourners Mr Chavez, who led Venezuela for 14 years, remained “undefeated, pure, living for all time”.
Mr Maduro was due to be sworn in as acting president later on Friday. He has to call elections within 30 days.
Opposition leader Henrique Capriles condemned Mr Maduro’s imminent inauguration as “fraudulent”.
He said that “nobody elected” Maduro president and that the government was “abusing” its powers.
Opposition parties are boycotting Mr Maduro’s swearing-in, arguing that under the constitution the speaker of the National Assembly should be the one to take over as acting president.
But, in a decision made public as the funeral went ahead, Venezuela’s Supreme Court ruled in Mr Maduro’s favour.
Hugo Chavez, 58, died on Tuesday after a two-year battle with cancer.
The vice-president began the funeral ceremony by presenting Mr Chavez’s coffin with the sword of Simon Bolivar – the 19th-Century independence leader he claimed as his inspiration.
In his eulogy, Mr Maduro said no other leader had been as vilified as Mr Chavez, but no-one had been able to stop him or his socialist “revolution”.
“The humble, the poor, the oppressed – we are his living testimony”, Mr Maduro said.
He also praised Mr Chavez’s work for Latin American unity, and said he worked for “a world without empires”.
More than 30 world leaders attended the ceremony, including Cuban President Raul Castro, Iran’s Mahmoud Ahmadinejad and Alexander Lukashenko of Belarus.
A message was read out from Syrian President Bashar al-Assad.
Honour guards were made up of prominent Venezuelans, including student leaders and baseball players, Formula One driver Pastor Maldonado and conductor Carlos Dudamel.
Mourners inside the venue chanted “Chavez did not die, he multiplied!”
Ecumenical prayers were led by three religious leaders, including the American civil rights activist, Rev Jesse Jackson, who called for reconciliation between Venezuela and the US.
“We share the same hemisphere, we play ball together, we trade resources together, we share dreams together,” he said.
Outside, huge crowds dressed in the red sang “Chavez lives!” and “The struggle continues!”
More than two million people have filed past Mr Chavez’s coffin, and his body is to be put on permanent display.
On Thursday, Mr Maduro said that Mr Chavez’s body would be embalmed “like Lenin and Mao Zedong”.
The body will be moved to the Caracas military museum where in 1992 Mr Chavez – as an army officer – was captured after leading a failed coup.