Harold Wilson feared that he and other British political leaders were being targeted by South Africa’s intelligence services over their opposition to apartheid, according to secret files.

Papers released by the National Archives in Kew, west London, show how the former Labour prime minister believed South African agents had played a role in forcing the former Liberal leader Jeremy Thorpe to step down over disclosures about an alleged gay affair.

In 1976, Sir Harold was so concerned that he ordered an investigation into “smear campaigns, plants and bribing of witnesses” by South African spies as they sought to shore up their racist regime.

He wrote: “The employment of such methods could be directed to destroying particular political leaders and, for a time at least, their parties.”