After spending almost two months in a Lahore jail for killing two Pakistanis, CIA contractor Raymond Davis was released today, ending one of the most serious diplomatic standoffs between Islamabad and Washington in nine years of partnering in the fight against terrorism.

Davis was set free after family members of the Pakistanis killed by Davis told a Pakistani court that they were dropping charges in exchange for financial compensation, often referred to as “blood money” in Pakistan.

It is likely that the deal to release Davis in exchange for compensation to the victims’ families was reached behind closed doors by Pakistan’s powerful intelligence agency, the Directorate of Inter-Services Intelligence (ISI) and the CIA. Pakistani media reports over the last few days hinted that the two intelligence agencies were working to recalibrate the relationship after a series of events had heightened tensions in relations. According to the Pakistani daily The Dawn, a Pakistani security official had noted in recent days that there had been “some positive developments” in negotiations between the two intelligence agencies and that the two sides were “grudgingly accommodating each other.”

Despite years of working closely to target al-Qaeda and other terrorists in Pakistan, the ISI and CIA had seen their relationship begin to fray, partly over Pakistan’s handling of terrorist group Lashkar-e-Tayyiba (LeT), which was responsible for the November 2008 Mumbai attacks. Pakistani-American David Headley, who was arrested in Chicago in October 2009 and later charged by a U.S. court with facilitating the Mumbai attacks as well as a planned terror attack in Denmark, revealed to interrogators that he was in close contact with Pakistani intelligence. As a result, the families of the six American victims of the Mumbai attack filed charges in a New York court against the head of Pakistan’s intelligence service, General Shujah Pasha, for involvement in the attacks. Pasha’s tenure as Director General of the ISI was recently extended by one year by Prime Minister Yousaf Raza Gilani.

Adding fuel to the fire, the CIA station chief in Islamabad was forced to leave the country last December after his cover was blown in the Pakistani media.

While resolution of the Davis case may help to cool tempers between the ISI and CIA in the immediate term, so long as Pakistan resists taking serious action against terrorist groups like the LeT, tensions in the relationship will persist.

Washington is increasingly and rightly concerned about the global reach of the LeT and the potential for the group to conduct a Mumbai-type of attack on U.S. soil. It is highly likely that the CIA had recently sought to develop independent sources of secret information on the group in Pakistan to avert such a possibility. Many analysts argue that the LeT is focused primarily on India and thus has little motivation to attack the U.S. directly. However, the skill with which U.S. citizen David Headley operated in close collaboration with the LeT for so many years has raised concern about the LeT’s level of sophistication and its potential capability to conduct an attack in the U.S. if it so chooses.

The Pakistani authorities must now brace for the public reaction to the release of Davis. The religious parties held numerous protests over the past several weeks against Davis’s release. Whether the Pakistani security establishment will be able to use their links to the religious parties to temper their response remains to be seen. Following the Pakistani military storming of the Red Mosque in Islamabad in July 2007, the religious parties strongly criticized the operation, but their public protests were muted. The Pakistani Taliban, which has conducted numerous suicide attacks inside Pakistan over the last three years, will almost certainly react with further violence in retaliation for Davis’s release.

While the release of Raymond Davis is indisputably good news for the U.S and may temporarily improve ties between our two intelligence agencies, it could also heighten anti-American sentiment in Pakistan, especially if the initial news reports that the families were pressured into accepting the blood money gain traction. While one diplomatic dispute between the U.S. and Pakistan has found resolution, the fundamental challenges to the relationship certainly remain.