LUANDA, Angola — The governing party won the most parliamentary seats in Angola’s election, the electoral authorities said Friday, empowering it to replace the longtime president who is stepping down after nearly four decades.

But the main opposition party disputed the results in the election held this week, asserting the vote had been marred by illegal actions that were “more than irregularities.”

With 98 percent of the votes counted, the electoral commission said that the governing party, the People’s Movement for the Liberation of Angola, or the MPLA, had won 61 percent of the vote, compared with 26 percent for the main opposition party, the National Union for the Total Independence of Angola, or Unita.

The MPLA’s presidential candidate, João Lourenço, the defense minister and a former governor, is likely to replace President José Eduardo dos Santos, who will step down after 38 years in office.