Hamas, the militant Palestinian organisation, attempted to conduct secret talks with the Israeli leadership in the protracted run-up to the recent war in Gaza - with messages being passed from the group at one stage through a member of prime minister Ehud Olmert's family.

Confirmation of attempts to establish a direct line of communication between Hamas and Israel - and the willingness of senior figures in Hamas to contemplate direct negotiations - fundamentally alters the narrative of the build-up to the war in Gaza which claimed more than 1,300 Palestinian lives and led to about a dozen Israeli deaths.

Most remarkable is the story of the involvement of a member of the prime minister's family in the passing of messages to Olmert about the case of the kidnapped Israeli soldier Gilad Shalit.

Although the Observer is aware of the identity of the family member and full details of the role played, it has agreed to protect anonymity. Gershon Baskin, a veteran Israel peace activist, was at the centre of attempts to open negotiations. Baskin was in touch with senior members of Hamas, Israeli officials and Olmert, via the member of his family.

Over two years, from the kidnap of Shalit, which triggered Israel's economic blockade of the Gaza Strip and its 1.5 million residents right up to the days before Israel launched its three-week long assault, Hamas officials expressed a willingness to talk to Israel directly about the kidnap, conditions for a new ceasefire and the ending of the blockade.

The motivation - from Hamas's side - stemmed from a growing frustration with the role of Egypt as an intermediary over key issues between the two sides, especially in relation to ceasefires.

Baskin, who has a long background in encouraging Israeli-Palestinian contacts, believes that the failure to pursue the overtures was a lost opportunity that contributed to the outbreak of conflict.

"Three times since Shalit's kidnapping [in June 2006 during a cross border raid out of Gaza] there has been the suggestion of opening a back channel through me. The first time that Hamas suggested to me opening a secret back channel was not long after Shalit's kidnapping."

According to Baskin, that offer was immediately rejected by the office of Olmert who said Israel did not negotiate with terrorists. His contacts, said Baskin, were two-fold. On the Hamas side, his contact was a senior figure whom he met in Europe, who was close to the organisation's leaderships both in the Syrian capital Damascus and the local leadership in Gaza. His liaison with the Hamas official focused on two issues: opening secret and direct contacts, and linking the prisoner exchange for Shalit's release to the renewal of the ceasefire and the ending of the economic siege on Gaza.

Baskin's "messenger" to Olmert on the Israeli side was the family member. "I was getting messages to Olmert through [this person]. And what I was getting back from Olmert through the same route was: 'We don't negotiate with terrorists'."

As part of this communication, which went on sporadically for months, Hamas offered a video proving Shalit was still alive, which would be supplied, the organisation said, in exchange for the release of some women and other minor prisoners from Israeli jails. Olmert's response - said Baskin - was that they did not need the video as Israel had already established that the soldier was alive. While that was rejected, the contact did, however, lead to a letter from Shalit to his father.

It was a channel of communication that was abruptly closed, allegedly when Israel's domestic intelligence agency Shin Bet intercepted members of Hamas discussing the identity of the Olmert family member involved in passing on the messages, infuriating Olmert.

A year after the first contacts, Baskin told the Observer, he had been given approval to pursue an informal effort to open secret direct contacts, co-ordinating with Ofer Dekel, the official appointed by Olmert as his "special representative" to head efforts for Shalit's return.

This time, however, it was Hamas's turn to block the opening of the secret negotiations - rejecting the linking of the prisoner exchange with the cease-fire and the end of the siege.

Baskin persisted with his dealings with Hamas, communicating with his contact through scores of emails, some passed on to the leadership in Syria and Gaza. While some hardliners, he readily admits, were not willing to initiate contacts - including Said Siam, the interior minister killed during Operation Cast Lead, and Mahmoud Zahar, who served as foreign minister - Baskin was able to reach other Hamas figures by email and text message - among them Hamas moderate and sometime spokesman Ghazi Hamad.

By now, Baskin admitted, his efforts to mediate between the two sides were largely his own initiative as he found himself increasingly shut out of the Israeli efforts to negotiate Shalit's release. He attempted too to use the Olmert "family member".

Two years after his first contacts through the Olmert family - and with war looming - Baskin said he tried to use his contact again. "I only involved [the person] one more time. I was desperate to get a message to Olmert." This time, however, he was told bluntly that he would "need to find another messenger". He told the Observer: "At this point war had already been decided on."

With the conflict only two weeks away Baskin arranged a meeting with his key Hamas contact in Europe, which resulted in another offer to link Shalit to the lifting of the blockade. Nobody on the Israeli side replied to the final offer.

· This article was amended on Sunday March 8 2009. "The lifting of the ceasefire" in the article above should have read "lifting of the blockade". This has been corrected.