When the United States was attacked on September 11, 2001 by 19 hijackers - 15 of them from Saudi Arabia - the kingdom switched into lobbying overdrive, determined to preserve a critical relationship.
After devoting well over $100m to influencing Washington, the oil-rich state is facing a PR crisis it didn't see coming - US lawmakers who once eagerly hobnobbed with Saudi princes, and institutions that were once only too happy to accept Riyadh's money, are looking to distance themselves.
The killing of exiled Saudi journalist Jamal Khashoggi - a regular presence on the Washington think tank circuit who died after entering the kingdom's consulate in Istanbul - has led to outrage at a level unseen in years against the kingdom.
Lawmakers have proposed once-thinkable actions such as suspending arms sales to Saudi Arabia, the largest buyer of US weapons, and expelling the kingdom's ambassador, although major repercussions look unlikely for now as President Donald Trump has called for preserving ties.
The Saudis had earlier looked confident of their lobbying might in Washington. In March, the Senate narrowly defeated a proposal to end US support for the Saudi-led campaign against rebels in Yemen, which according to the United Nations has killed thousands of civilians.
Soon afterward, Crown Prince Mohammed bin Salman, a 33-year-old who had billed himself as a reformer, triumphantly visited the United States where he met figures ranging from Trump to talk show queen Oprah Winfrey.
"A lot of Americans don't really know much about Saudi Arabia. It's not a big destination for travel, for a lot of reasons, and it was easy for PR firms to fill that role," said Ben Freeman, director of the Foreign Influence Transparency Initiative at the Centre for International Policy.
"I think what happened is that this case really brought it home," he said. "Jamal Khashoggi was living here and I think a lot of journalists took this personally in that one of their own was attacked."
Even if the values of the austere Muslim state would seem alien to most Americans, Saudi Arabia has penetrated Washington's power-centres by opening its checkbook to influential think tanks, wooing journalists and hiring former senior politicians who stand to earn more money as lobbyists.
Among those former lawmakers, according to legally required filings with the Justice Department, are Norm Coleman, a former Republican senator from Minnesota, who signed a $125 000-a-month deal this year to represent the Saudi embassy, and Buck McKeon, until 2015 the chairperson of the House Armed Services Committee, whose firm is paid $50 000 a month by Riyadh. Neither responded to requests for comment.
CNN's chief Washington correspondent Jake Tapper, one of the most visible US television journalists, tweeted that the Saudi embassy contacted him after his favourite football team, the Philadelphia Eagles, qualified for this year's Super Bowl and offered to fly him to see the championship game as its guest. He said he declined, "But I wondered: who said yes?"
Since Khashoggi's disappearance, at least four lobbying firms have said that they will no longer represent Saudi Arabia. Among those terminating involvement is leading lawyer Theodore Olson, who argued for former president George W Bush before the Supreme Court and whose firm would have pocketed at least $250 000.
Washington think tanks have quietly backed away from Saudi Arabia. The Middle East Institute, which has long partnered with Riyadh, voiced "shock and outrage" over the death of Khashoggi, who frequently participated in the group's panels, and cut back ties.
Among two of the most prestigious think tanks, the Brookings Institution ended a Saudi contract while the Centre for Strategic and International Studies said only that it was reassessing its relationship with Riyadh.
Stepping up spending
Saudi Arabia spent more than $18m last year and $6m so far in 2018 either through its government or affiliates to seek influence in Washington, according to the Centre for Responsive Politics, which compiles data.
An even bigger spender has been Saudi ally the United Arab Emirates, although the top-paying are South Korea and Japan, which largely focus on trade promotion.
While US law forbids foreign agents from funding US candidates, Freeman said his research spotted a grey area.
Firms that represent Saudi clients gave nearly $400 000 to congressional candidates last year, sometimes donating after raising Riyadh's concern with lawmakers, he said.
The Saudis boosted spending with Trump's election after rocky relations with his predecessor Barack Obama, who eased tensions with the kingdom's regional rival Iran.
Obama, however, sided with the Saudis on one of the kingdom's biggest legislative defeats - a bill that lets families of September 11 victims sue Saudi Arabia, a move Obama argued could trigger lawsuits abroad against the United States.
Jamie Fly, a senior fellow at the German Marshall Fund of the United States, expected congressional pressure only to grow over weapons sales.
"The administration is going to have to respond in some way to that congressional pressure and to show concerned members of Congress that they are taking this seriously," he said.