But the political upheaval in the Middle East and the American perception that the Saudis are critical to stability in the region continue to hold together an increasingly fractious marriage. So when Saudi Arabia executed 47 people, including Sheikh Nimr al-Nimr, the dissident cleric, on Saturday, beheading many of them in a style that most Americans associate with the Islamic State rather than a close American partner, the administration’s efforts to explain the relationship became more strained than ever.

In fact, the executions were the culmination of a series of events in the past few years that have led to clashes between the two nations.

“We haven’t been on the same page with the Saudis for a long time,” said Martin S. Indyk, the executive vice president of the Brookings Institution and a former top aide to Secretary of State John Kerry. “And it starts with Mubarak.”

In 2011, Saudi leaders berated President Obama and his aides for failing to support President Hosni Mubarak of Egypt during the Arab Spring, fearing Mr. Obama might do the same thing if the uprisings spread to the kingdom.

The nuclear deal with Iran only fueled the Saudi sense that the United States was rethinking the fundamental relationship — and Saudi officials, on visits to Washington, openly questioned whether they could rely on their American ally. It was King Abdullah who was quoted in a 2008 State Department cable, released two years later by WikiLeaks, exhorting the United States to “cut off the head of the snake” — Iran — by launching military strikes. He died before last summer’s deal, but Saudi leaders, who still see Iran’s hand behind every destabilizing act in the Middle East, argued that the administration was naïve to think that Iran would abide by any negotiated accord.