King Abdullah of Jordan looked suitably solemn at the funeral for Captain Sharif Ali bin Zeid, the intelligence officer killed in Afghanistan by his own agent-turned-suicide-bomber. But signs are the king has been badly discomfited by the unprecedented public exposure of his country's role working with the CIA.

It is no secret that Jordan is the most pro-western country in the Arab world. Squeezed uncomfortably between Iraq in the east and Israel to the west, it has always been pragmatic about both – while remaining a close and loyal US ally.

The late King Hussein was even reported to be on the CIA payroll, while his intimate relations with successive British governments have continued under his son. The Jordanian capital, Amman, served as a base for western intelligence operations against Iraq during the long years of sanctions against Saddam Hussein – after the king's uncharacteristic recklessness in publicly backing Baghdad after the 1990 invasion of Kuwait.

Jordan's General Intelligence Department (GID) – universally known as the Mukhabarat – is admired by professionals and is sometimes compared to Israel's Mossad secret service. Having its own website provides a veneer of modernity but it has a reputation for ruthlessness that has brought harsh criticism from human rights groups. It plays a key role monitoring Jordan's domestic politics.

The GID became a big player in the post-9/11 effort by western intelligence agencies – spearheaded by the CIA – to penetrate jihadist groups. Jordan's best-known coup was providing the information for the US missile strike that killed Abu Musab al-Zarqawi, the Jordanian man from Zarqa, north-east of Amman, who became leader of al-Qaida in Iraq and who was responsible for the videotaped beheadings of hostages including Briton Ken Bigley.

Jordanian intelligence officers work with their US counterparts interrogating suspected terrorists and have co-operated with renditions to and from Guantánamo Bay. CIA officers are stationed inside the GID's sprawling Amman HQ. That, it seems likely, was the home to the operation involving Humam Khalil Abu-Mulal al-Balawi, the al-Qaida agent who killed seven CIA staff and Bin Zeid, his handler, in Khost, Afghanistan.

Blowback from the war in Iraq erupted spectacularly in Jordan in 2005 when three Iraqi al-Qaida suicide bombers slaughtered 60 people, many of them wedding guests, in co-ordinated attacks on three Amman hotels. It was the worst terrorist atrocity the country had suffered.

Since then the GID has developed a successful western-style anti-terrorist strategy that combines the use of intelligence with elite special forces. Its Fursan al-Haq (Knights of Justice) unit has operated inside Iraq, exploiting cross-border tribal links in Anbar province.

The discreet relations between the CIA and Jordan have long been familiar to intelligence aficionados – and were described in Body of Lies, a thriller by the American author David Ignatius that was turned into a Hollywood film starring Russell Crowe and Leonardo di Caprio. But these close relations were not widely known – until now.

"The CIA connection … has now been put out in the public sphere for all to see – especially the Arab street," wrote one Jordanian blogger. "The Jordanian government will likely go on as if nothing ever happened, believing that Jordanians have no access to information, but [as] practically every Jordanian household has al-Jazeera and a million other channels, this is one piece of information that isn't going to be kept quiet."

Jordanian officials and the official media reported on Bin Zeid's death and funeral, but described his role as part of a previously unknown "humanitarian mission" in Afghanistan. Nor has there been any mention of co-operation with the CIA. Islamist opposition groups were quick to attack the Afghan deployment as illegal under Jordanian law.

The line from Amman is that Balawi was a simple informant rather than a triple agent who had been recruited and handled by the Mukhabarat – a clear effort to limit the damage caused by this shadowy affair. But Balawi's family in Zarqa have been warned not to discuss him with the media. That's hardly surprising considering the profoundly embarrassing implications.