Updated 4:17 p.m. ET
LAHORE, Pakistan - An American CIA contractor who shot and killed two Pakistani men was released from prison Wednesday and left Pakistan after more than $2 million in "blood money" was paid to his victims' families, defusing a dispute that threatened an alliance vital to defeating al Qaeda and ending the Afghan war.
In what appeared to be carefully choreographed end to a crisis that had stoked anti-Americanism to new heights, the U.S. Embassy said the Justice Department had opened an investigation into the killings on Jan. 27 by Raymond Allen Davis.
It thanked the families for "their generosity" in pardoning Davis. U.S. Secretary of State Hillary Clinton denied the U.S. had made any payments, but she didn't dispute that the men's families were compensated. A lawyer for the families said the money came from the Americans.
While the deal removed the most obvious obstacle to improved ties between the two nations, the affair revealed just how fragile the alliance is despite efforts by the Obama administration to secure Pakistan's cooperation in the fight against extremism.
The main problem is their apparent differing strategic interests in Afghanistan, an issue that is becoming more acute as Washington eyes an end to the war. Pakistan's chief concern is ensuring the country is not an ally of its long-term enemy, India, and has been reluctant to crack down on Afghan Taliban factions sheltering on its soil that it believes could be effective proxies down the line.
Antagonism was especially sharp between the CIA and Pakistan's powerful Inter Services Intelligence, which says it did not know Davis was operating in the country. One ISI official said the agency had backed the "blood money" deal as a way to soothe tensions.
The Davis affair had been a staple for right-wing Islamist parties, who rallied around it as another example of U.S. brutality and their government's subservience to Washington. They had urged the families to reject any "blood money" and called on the government to hang him.
Protesters took to the streets in major cities after nightfall, briefly clashing with police outside the U.S. consulate in Lahore, where officers fired tear gas at men burning tires and hurling rocks. Some called for larger protests Friday after noon prayers.
"I am not ready to buy that the families have struck a deal," Hamid Gul, a former ISI chief turned cheerleader for right-wing causes, said on a popular TV talk show. "This is shameless surrender. We are being sold and not even told about, I appeal the people not only to condemn it, but also rise against it."
Davis, a 36-year-old Virginia native, claimed he acted in self-defense when he killed the two men on the street in the eastern city of Lahore. The United States initially described him as either a U.S. consular or embassy official, but officials later acknowledged he was working for the CIA, confirming suspicions that had aired in the Pakistani media.
The U.S. said the two victims were robbers, but there has been persistent speculation they were employed by the ISI to trail him or were known to him, perhaps as his own informers in the city. Their families insisted they were regular citizens, but acknowledged one was carrying a gun.
The United States had insisted Davis was covered by diplomatic immunity, but the weak government here, facing intense pressure from Islamist parties, sections of the media and the general public, did not say whether this was the case and now will presumably not have to do so at all.
Rebecca Davis said she was elated when she learned of her husband's release in a phone call at 6:30 a.m. She said she doesn't know where the money paid to release her husband came from.
"I knew it was self-defense. My husband is not a killer. He's not a Rambo," she said, speaking outside her home in Highlands Ranch, Colorado.
The payment of "blood money" had been suggested as the best way to end the dispute for the Pakistani government and the United States, but the speed in which the deal was done and Davis left the country surprised many here. The practice, which comes from Islamic law, is common and legal in Pakistan, but criticized by human rights groups.
Punjab Law Minister Rana Sanaullah said Davis was charged with murder Wednesday in a court that was convened in a prison in Lahore, but was immediately pardoned by the families of the victims after the payment. Reporters were not allowed to witness the proceedings.
"This all happened in court and everything was according to law," said Sanaullah. "The court has acquitted Raymond Davis. Now he can go anywhere."
U.S. officials said Davis left the country soon after his release from jail.
Raja Muhammad Irshad, a lawyer for the families, said 19 male and female relatives appeared in court to accept the $2.34 million from the U.S. One Pakistani official said the sum was just under twice that, while other media outlets reported the amount was between $700,000 and $1.4 million.
He said each told the court "they were ready to accept the blood money deal without pressure and would have no objection if the court acquitted Raymond Davis."
Representatives of the families had previously said they would refuse any money. They were not available for comment.
Some media reports said the some of the families had been given permission to live in the United States.
Irshad said that was not discussed in court.
Asad Mansoor Butt, who had earlier represented the families, accused Pakistan's government of pressuring his former clients; he gave no details.
The CIA and the ISI cooperate in tracking down militants inside Pakistan and on drone strikes that kill insurgents in the northwest, but have an uneasy friendship. Before the Davis case, the CIA station chief had to leave Pakistan after his name appeared in the local media.
CIA director Leon Panetta and ISI chief Gen. Shuja Pasha talked in mid-February to smooth out the friction between the two spy agencies, according to an ISI official and once from the U.S. agency.
Pasha demanded the U.S. identify "all the Ray Davises working in Pakistan, behind our backs," the ISI official said.
He said Panetta agreed "in principle" to declare such employees, the official said, but would not confirm if the agency had done so.
A second ISI official said as a result of that conversation the ISI then backed an effort to negotiate the "blood money." The officials spoke on condition of anonymity because they are not allowed to give their names to the media.
CIA Spokesman George Little said the two agencies had had "a strong relationship for years."
"When issues arise, it is our standing practice to work through them. That's the sign of a healthy partnership, one that is vital to both countries, especially as we face a common set of terrorist enemies," he said.