Bell Pottinger, one of the world's richest and most powerful public-relations firms, has made its fortune by burnishing the images of the autocratic and the notorious, from Augusto Pinochet of Chile to the First Lady of Syria and the repressive regimes of Belarus, Egypt and Saudi Arabia.

But the London-based agency, founded by Margaret Thatcher's former spin doctor, may have finally met its match in the free-wheeling democracy of South Africa. When it secretly devised a racially divisive campaign on behalf of President Jacob Zuma's son and business cronies for a fee of about $170,000 a month, the campaign soon spiralled into disaster.

This week, Bell Pottinger formally apologized to the people of South Africa, admitting that its tactics were "offensive" and unethical. It fired a senior employee, suspended three others, expressed "profound regret," and promised to publish the findings of an independent investigation.

Story continues below advertisement

"These activities should never have been undertaken," said a statement by James Henderson, chief executive of Bell Pottinger. "We are deeply sorry that this happened."

Bell Pottinger was founded by Lord Timothy Bell, who gained fame as communications adviser to former British prime minister Thatcher. It has worked for foreign governments, multinational corporations, military contractors, the U.S. military administration in Iraq, celebrities such as Oscar Pistorius after his murder arrest, and Asma al-Assad, wife of Syria's dictator.

Leaked e-mails have revealed that Bell Pottinger created a dangerous strategy of exploiting South Africa's racial tensions to benefit the interests of the wealthy Gupta brothers, businessmen with close connections to Mr. Zuma and his family.

The Guptas, in partnership with Mr. Zuma's son Duduzane, used their corporate vehicle, Oakbay, to hire the British firm in early 2016, at a time when the two families and the Zuma government were increasingly embroiled in corruption scandals.

Soon, the British agency was helping push a racially explosive campaign by Oakbay and the youth wing of Mr. Zuma's ruling party that invoked "economic apartheid" and "white monopoly capital" that had a "stranglehold" on the economy. In one leaked e-mail, the agency called for "emotive language" such as "economic emancipation." In another e-mail, an agency executive praised a youth leader in the ruling party who had threatened "civil war" against an opposition party.

The strategy expanded into social media, where hundreds of fake Twitter accounts were created to push the same racial message, often targeting white businesses and journalists with hate-filled rhetoric. It is unclear exactly who created the accounts, although the South African media have revealed that many of the accounts were linked to Gupta-owned companies.

The strategy seemed briefly successful, diverting attention from the mounting evidence that the Guptas had corrupt influence over the Zuma government.

Story continues below advertisement

Investigations have found that the Guptas were so powerful that they even controlled Mr. Zuma's cabinet appointments. Media reports have documented how Gupta companies siphoned huge sums of money from state-owned enterprises with the support of Gupta-allied cabinet ministers. But the Bell Pottinger campaign blamed white-owned businesses for South Africa's problems, fuelling racial conflict in a nation still struggling to heal its apartheid wounds.

The campaign provoked outrage across the country as Bell Pottinger's role became clear, even after the company announced in April that it was halting its Oakbay work. Unlike the authoritarian regimes where Bell Pottinger has often worked, South Africa has a thriving democracy and a vibrant media and civil-society sector that could fight back against the foreign-orchestrated campaign.

On social media, thousands of South Africans hounded the British company. Whenever the agency tweeted on any subject, it was immediately deluged with hundreds of furious tweets from South Africans, calling it "evil" or worse. The company was stunned by the reaction. It briefly locked its Twitter account to make it private, then began blocking its critics to prevent them from seeing its tweets – an extreme move for a PR agency.

An opposition party, the Democratic Alliance, requested an investigation of Bell Pottinger by an industry group, the Public Relations and Communications Association, which has confirmed that it is formally investigating the agency's conduct.

Bell Pottinger also launched its own probe. "It was said that we had supported or aided campaigns to stir up racial division in South Africa," the company said in its statement this week. "Therefore we called in the leading independent law firm, Herbert Smith Freehills LLP, to review the account and the work done on it."

The agency said it will publish the findings and take action on them. "However, we have already been shown interim evidence which has dismayed us," it said.

Story continues below advertisement

"Much of what has been alleged about our work is, we believe, not true – but enough of it is to be of deep concern. There has been a social media campaign that highlights the issue of economic emancipation in a way that we, having now seen it, consider to be inappropriate and offensive … For it to be done in South Africa, a country which has become an international beacon of hope for its progress towards racial reconciliation, is a matter of profound regret and in no way reflects the values of Bell Pottinger."

The company said its senior managers had been "misled" about what the South African campaign involved. But many South Africans find it difficult to believe the company was unaware of what its employees were doing.

One prominent civil-society coalition, Save South Africa, said the Bell Pottinger apology was "insufficient and totally unacceptable." It called for full disclosure of the firm's campaigns for Oakbay, including the front groups that it is believed to have secretly funded.

"This British company has further polarized South African society and left deep scars in our social fabric," the civil society coalition said.

"It cannot be left to hide behind spin and say it was 'misled.'"