South Africa's President Cyril Ramaphosa was jeered and whistled at on Saturday during his speech at Zimbabwe ex-leader Robert Mugabe's funeral before he apologised for recent xenophobic attacks.
At least 12 people have been killed this month in a surge in violence and mob attacks against foreign-owned businesses in and around Johannesburg, South Africa's largest city.
A wave of jeers, boos and whistles interrupted Ramaphosa at the Harare national stadium as he started his eulogy at the state funeral for Mugabe, who died age 95 last week.
"I stand before you as a fellow African to express my regret and apologise for what has happened in our country," Ramaphosa said after one of the organisers tried to calm the crowd.
His comments were met with cheers and blasts of sound horns from the crowd.
South Africa, the continent's second largest economy, is a major destination for other African migrants. But they are often targeted by some locals who blame them for a lack of jobs.
But with shops and homes burned and looted and clashes between armed mobs of looters and police, hundreds of migrants from Mozambique and Zimbabwe have fled to shelters.
Nigeria's government has flown around 600 of its citizens home from Johannesburg after some of them were targeted in the violence