Washington: Pakistani spy agency ISI having close ties with terror groups is an open secret and this was the reason why the US did not share the intelligence about the raid on Osama bin Laden's hideout with Islamabad, former Defense Secretary and ex-CIA Director Leon Panetta has said.

"We had been discussing this for months, and it was an open secret that Pakistan's intelligence agency had ties to terrorist groups - that, after all, was a major part of our rationale for not sharing our bin Laden intelligence with the ISI," Panetta wrote in his book 'Worthy Fights: A Memoir of Leadership in War and Peace' which hit the stores yesterday.

Panetta was the CIA Director in the first term of the Obama Administration and was also his Defense Secretary later.

In both these position, Panetta was a strong advocate of US-Pakistan relationship and always came out in strong defense of ISI and the Pakistan Army whenever there were allegations of the spy agency having links with the terrorist outfit.

In fact, while serving in the Obama administration - both as CIA chief and Defense Secretary - Panetta always issued certificates to ISI on allegations of its links with terror outfit. However, in his latest book, the first after he left the Obama Administration some two years ago, Panetta speaks in an altogether different tone.

"One of the most complicated international relationships to manage in my years with President Obama was that between the United States and Pakistan," Panetta wrote.

"At their core, both countries realized we needed each other's help, but we didn't trust each other. It showed," the former Defense Secretary added.

Referring to the remarks of the then Chairman of the Joint Chiefs of Staff, Admiral Mike Mullen, before a Senate Committee, Panetta said Mullen spoke the truth that day.

"For the most part, our uneasiness concerning Pakistan was unspoken. We grumbled about it in the inner circles of government, but made nice in public. Then, on September 22, Admiral Mullen, approaching the end of his tenure as chairman of the Joint Chiefs, told a blunt truth and did so publicly," Panetta wrote.

"Testifying before the Senate Armed Services Committee,

and with me sitting beside him, Mullen announced that the Haqqani network, a leading insurgent group fighting against American forces in Afghanistan, was a 'veritable arm of Pakistan?s Inter-Services Intelligence Agency'," Panetta says.

"That network, he added, was behind a recent attack on the American embassy in Kabul as well as a June 28 attack against the Inter-Continental Hotel in that same city. In effect, Mullen accused our Pakistani allies of suborning attacks on American forces, diplomats, and citizens. That was sure to cause a controversy, and it did, but I was in some ways surprised by the expressions of shock," Panetta writes, noting that such a statement from Mullen was an open secret.

"As he usually did, Mullen spoke the truth at the hearing that day; as is too often the case, there were repercussions. Pakistani officials called his testimony 'irresponsible' and said his comments threatened to rupture relations between our countries," the former CIA Director said.

"Things went from bad to worse over the next few months. On November 26, International Security Assistance Forces, the formal name for our coalition in Afghanistan, came under attack along the Afghanistan-Pakistan border, with incoming rounds emanating from the Pakistani side," he said.

"The ISAF soldiers attempted to contact their Pakistani counterparts over the radio, but received no response. They then opened fire with a counteroffensive, calling in aircraft gunships to defend their positions. The battle ended with 28 Pakistani soldiers dead. Pakistan was outraged," he wrote.

In his book, Panetta writes how he prevented the US from issuing an apology, which was being advocated by the State Department. But the White House supported him.

"Within the administration, there was a pitched debate about whether to apologise. State Department officials responsible for managing our relationship with Pakistan wanted us to say we were sorry and get on with it, while I thought we should express our regrets but only apologise if we concluded we were to blame," he writes.

"I braced for the White House to side with State, but in this case McDonough told Jeremy that if we didn't think we had something to apologise for, we shouldn't. That gave me the political cover I needed to rebuff State's apology caucus," Panetta writes.