He has spearheaded the reform effort, and is reshaping the power dynamic in the kingdom and the entire region. But his nobler pretensions have been muted by his outsize spending habits, as well as a roundup of billionaires, princes and other officials tied to previous governments. The government is said to have used coercion and physical abuse to seize billions of dollars from the detainees, who were initially held at the Ritz Carlton in Riyadh.

The prince’s motives were again called into question two weeks ago, when Saudi authorities detained activists who had pushed for the right for women to drive, even though the kingdom gave in to the campaign.

SCL’s work was shrouded in secrecy, but one former analyst at the company, James Lovell, who listed the Saudi project on his LinkedIn profile, said he “analysed focus group data, contributed to presentations and wrote reports for a research project on economic reform in the Kingdom of Saudi Arabia.” A project manager at Cambridge Analytica, Alexandra Wicksell, wrote in her profile on the same site that the work was “focused on developing the national reform initiative for the country’s drive to diversify its economy away from its oil dependency.”

Others who saw the work described it less benignly.

One Western consultant, who was not involved in the project but who viewed SCL’s report, referred to the firm’s finding as “Machiavellian,” calling it a manual for the royals to manage popular sentiment by figuring out where they should loosen their grip. The consultant said the report used dozens of focus groups to examine levels of frustration and satisfaction, as well as the legitimacy of the royal family and the political structure, and showed there was widespread discontent.

The consultant’s account was consistent with that of a former employee at SCL. The company’s work, said the former employee, was aimed at conducting a behavioral analysis of the population and then creating strategies to keep the government viable in an era of declining oil prices.

A company executive referred to the work as advancing human rights but declined to comment further. The Saudi government declined to comment.