LUANDA - Angolans and foreign dignitaries gathered on Sunday for the funeral of long-serving ex-leader Jose Eduardo dos Santos, who died in Spain in July but whose burial was delayed by a family request for an autopsy.

The funeral of Dos Santos, who died in a clinic in Barcelona on July 8 at the age of 79, is taking place days after an election appeared to have returned his MPLA party to power in results that have been disputed by the country's main opposition coalition.

Dos Santos and his family dominated Angolan politics for the 38 years that he ruled, up to 2017. His formerly Marxist party, the People's Movement for the Liberation of Angola (MPLA), in power for nearly five decades, looks almost certain to have won Wednesday's election.

Heads of state and senior ministers from around the continent, as well as the president of Angola's former colonial ruler Portugal, Marcelo Rebelo de Sousa, were slated to attend.

The presence of foreign VIPs has enabled authorities to seek to head off possible protests over the disputed provisional results.

"Due to the state funeral of the late former president Jose Eduardo dos Santos, the national police appeals to all citizens, civil society and organised groups that intend to organise activities on Saturday and Sunday, to contain themselves out of respect for the former head of state," Angola's National Police said in a statement reported by the Lusa news agency on Saturday.

With 97% of ballot counted, the electoral commission has given the MPLA and President Joao Lourenço a 51% majority, with the main opposition the National Union for the Total Independence of Angola, or UNITA, trailing with 44.5%.

UNITA's leader, Costa Junior, has rejected the results as fraudulent, and there have been sporadic protests that were quickly shut down by police. The electoral commission has said the process was fair and transparent.

Both Lourenço and Junior were expected to attend the funeral.

Dos Santos' body was returned to the country last weekend, after being delayed by a full autopsy that had been requested by his daughter, Tchize. A Spanish judge ruled the death was from natural causes.

Thousands of Angolans came out onto the streets to pay their respects to Dos Santos on Saturday.

"I am here and tears came to my eyes because this moment is not easy," said 39-year-old Filomeno Augustinho. "If we got here today it was (because) of the stability (Dos Santos) gave us."

But opposition supporters - who include poor Angolans left out of growth driven by vast oil wealth in one of the world's most socially unequal countries - were less enthusiastic.

"Right now our attention is focused on the election," Dionisia Domingos, 38, who works in administration in a company in Luanda, told Reuters.

"The funeral seems to be ... to divert the attention of the international community and the population (from) the election results and the fraud."

Authorities did not immediately respond to a request for comment.

(Additional reporting by Catarina Demony in Lisbon, Writing by Tim Cocks Editing by Frances Kerry)