Why did it take Washington more than seven months to apologize for the deaths of 24 Pakistani soldiers? But you know the answer: It’s because the United States and Pakistan have the most neurotic, mutually destructive “friendly” relationship in the world.

Secretary of State Hillary Clinton finally said the magic words in a July 3 phone call with her Pakistani counterpart: “We are sorry for the losses suffered by the Pakistani military.” A tepid apology, but enough that the Pakistanis agreed to reopen the border crossings into Afghanistan that had been closed since the Nov. 26 accidental attack.

This story is even stranger than has been reported. The Obama administration had reached a tentative decision to express regret months ago. But it balked after it had to apologize for another agonizing mistake, the Feb. 22 accidental burning of Korans at Bagram air base. A further delay resulted when Pakistan’s foreign minister, Hina Rabbani Khar, advised that an apology should wait until Pakistan’s parliament was in session.

It would be nice if the case of the delayed apology was an unusual example of U.S.-Pakistani mistrust. But it’s unfortunately a classic illustration of what’s so odd about this relationship. The two countries talk about strategic cooperation one month and feud the next. They claim to be allies against terrorism, even as each side’s intelligence service conducts operations the other regards as hostile.

A useful bridge in this neurotic relationship was Husain Haqqani, Pakistan’s former ambassador to Washington. He tried to maintain dialogue across the gulf of suspicion — and also tried to represent the frail civilian government, as opposed to the overpowering Pakistani military. What did Haqqani get for his trouble? He was fired after accusations that he was a traitor. He’s now preparing to teach this fall at Boston University, which is good for students there but a waste for Pakistan.

When you look back at the past few years of this relationship, what is striking is how the two countries always seem to be sulking — feeling unappreciated and ill-used. Since an open breach doesn’t suit either side, they avoid a final rupture. But the bad feeling has hardened to something dark and dense.

For examples of how crazy this relationship can be, consider two instances when President Obama tried to convey the message — something between a plea and a demand — for better Pakistani cooperation against al-Qaeda and the Taliban. Both times he got, basically, zilch.

●Obama sent a secret presidential letter dated Nov. 11, 2009, that stated: “We must find new and better ways to work together to disrupt (the extremists’) ability to plan attacks against targets in Pakistan, the region and beyond — including the United States — so that we can eventually destroy its networks.”

The response from President Asif Ali Zardari was likely drafted by Pakistani intelligence. “Let me right at the outset unequivocally reaffirm the resolve of the people of Pakistan to fight and uproot terrorism,” the letter began. But it spun off into a wild allegation of an Indian-backed “proxy war . . . in which neighboring intelligence agencies are using Afghan soil to perpetrate violence in Pakistan.”

Haqqani is said to have warned Islamabad that an ambivalent Pakistani response would be seen as unacceptable. The message apparently didn’t register.

●Obama met in the White House on Oct. 20, 2010, with Pakistani army chief Ashfaq Parvez Kayani. According to one account, Obama warned that “trust does not happen overnight, but it has to happen. Otherwise we will be on a collision course.” As for the alleged threat posed by America’s rapprochement with India, Obama said flatly: “Your intelligence is wrong. You are hearing from the president of the United States that the U.S. wants a strong, stable Pakistan.”

And what was Kayani’s response? He handed Obama a 14-page memo titled “Pakistan’s Perspective” that said in its concluding section: “Pakistan is being made a scapegoat. . . . U.S. is ‘intrusive’ and ‘overbearing’ — wants to micromanage. U.S. is causing and maintaining a controlled chaos in Pakistan. The real aim of U.S. strategy is to de-nuclearize Pakistan.”

Still, said Kayani in the memo’s final passage: “At the end of the day, we would like to be standing in the right corner of the room.” So would America, especially as it begins withdrawing combat troops from Afghanistan.

So maybe we should be thankful for the bizarre behavior surrounding this month’s tepid apology. The crazy couple is patching up another quarrel. The soap opera continues. Better that than a nasty finale.