It's the relationship that never was. Kept to the shadows, it was shielded behind secret agreements and disinformation that dressed up military cooperation as mining deals.

But when the spotlight occasionally flickered over one of the most intimate and enduring alliances of the postwar years, Israel was quick to underplay its deep military ties with apartheid South Africa as nothing more than a necessity of survival without a flicker of ideological affinity.

But as is shown by Sasha Polakow-Suransky's book, The Unspoken Alliance, that relationship went beyond mere convenience.

For years after its birth, Israel was publicly critical of apartheid and sought to build alliances with the newly independent African states through the 1960s.

But after the 1973 Yom Kippur war, African governments increasingly came to look on the Jewish state as another colonialist power. The government in Jerusalem cast around for new allies and found one in Pretoria. For a start, South Africa was already providing the yellowcake essential for building a nuclear weapon.

By 1976, the relationship had changed so profoundly that South Africa's prime minister, John Vorster, could not only make a visit to Jerusalem but accompany Israel's two most important leaders, Yitzhak Rabin and Shimon Peres, to the city's Holocaust memorial to mourn the six million Jews murdered by the Nazis.

Neither Israeli appears to have been disturbed by the fact that Vorster had been an open supporter of Hitler, a member of South Africa's fascist and violently antisemitic Ossewabrandwag and that he was interned during the war as a Nazi sympathiser.

Rabin hailed Vorster as a force for freedom and at a banquet toasted "the ideals shared by Israel and South Africa: the hopes for justice and peaceful coexistence".

A few months later, the South African government's yearbook described the two countries having one thing in common above all else: "They are both situated in a predominantly hostile world inhabited by dark peoples."

A year earlier, Israel had offered to sell South Africa nuclear warheads.

"South Africa's leaders yearned for a nuclear deterrent – which they believed would force the west to intervene on their behalf if Pretoria were ever seriously threatened – and the Israeli proposition put that goal within reach," Polakow-Suransky says in the book.

The deal did not go through but there was plenty of other cooperation in the development of military technology.

Alon Liel, a former Israeli ambassador to Pretoria who headed his foreign ministry's South Africa desk in the 80s, once told the Guardian that gold-rich South Africa funded the joint military projects and Israel provided much of the technical knowledge.

"After 1976, there was a love affair between the security establishments of the two countries and their armies," he said. "We were involved in Angola as consultants to the [South African] army. You had Israeli officers there cooperating with the army. The link was very intimate."

By the late 1970s, South Africa was Israel's single largest customer for weapons.

Polakow-Suransky establishes that the relationship was so intimate that in the mid-1970s, South Africa lifted the safeguards supposed to govern how the yellowcake was used to prevent nuclear proliferation.

In return, Israel sent South Africa 30 grams of tritium, which gives thermonuclear weapons the boost to their explosive power. The delivery was enough to build several atomic bombs, which South Africa did in the coming years.

Peres was central to the relationship. He was defence minister at the time of Vorster's visit to Jerusalem and twice served as prime minister during the 1980s as the alliance with the apartheid government solidified.

Five years ago, I asked him about the morality of ties with the white regime.

"Every decision is not between two perfect situations. Every choice is between two imperfect alternatives. At that time the movement of black South Africa was with (PLO leader Yasser) Arafat against us. Actually, we didn't have much of a choice. But we never stopped denouncing apartheid. We never agreed with it," he said

And a man like Vorster?

"I wouldn't put him on the list of the greatest leaders of our time," said Peres.

Yet attempts by the man who is now Israel's president to portray his country as forced in to a reluctant alliance with an ideological foe are undermined by his enthusiastic expressions of common ideals.

In 1974, Peres wrote to the South African information minister, Eschel Rhoodie, speaking of the "unshakeable foundations of our common hatred of injustice and our refusal to submit to it".

Peres was not alone. Rafael Eitan, the former Israeli military chief of staff, was among those who spoke of his sympathy for the white regime's position. So did Ariel Sharon, the future prime minister.

In the late 80s, as international pressure on the apartheid government grew, Israel's political leadership decided it was time to retreat. But Liel said that the security establishment balked.

"When we came to the crossroads in 86-87, in which the foreign ministry said we have to switch from white to black, the security establishment said, 'You're crazy, it's suicidal'. They were saying we wouldn't have military and aviation industries unless we had had South Africa as our main client from the mid-1970s; they saved Israel. By the way, it's probably true," he said.