The price of oil was in free fall and a youthful population restive.

So the government of Saudi Arabia turned in recent years to the parent company of the political data firm Cambridge Analytica for help, according to Western consultants who worked in the kingdom, company executives and a review of public documents.

The work by Cambridge's parent, a secretive defense and intelligence contractor called SCL Group, presaged the tumultuous changes that are reshaping the kingdom. The company, now mired in scandals related to its corporate practices and the use of Facebook user data, conducted a detailed population study. It provided a psychological road map of the kingdom's citizenry and their sentiment toward the royal family, even testing potential reform steps as they charted a path forward to preserve stability.

Read more from The New York Times:

Saudis said to use coercion and abuse to seize billions

Data firm tied to Trump campaign talked business with Russians

He owns much of Ethiopia. The Saudis won't say where they're hiding him

The consultants and executives spoke on the condition of anonymity because they were bound by nondisclosure agreements.

One proposal tested by the company was lifting a 35-year ban on cinemas in the kingdom, an action that was subsequently taken in December. Another was allowing women to drive, a move that was made last September.

Under King Salman, who came to power in January 2015, the Saudis have turned to an array of consultants as crashing oil prices laid bare the kingdom's lack of economic diversification. Some consultants, such as McKinsey & Company and the Boston Consulting Group, carried blue chip pedigrees, while SCL, founded in 1993 as Strategic Communication Laboratories, was known for its clandestine work.

The company has recently burst into the public eye amid revelations that it employed seduction and bribery to entrap politicians and influence foreign elections. And its Cambridge Analytica unit, which worked for President Trump's campaign, collapsed amid allegations of misusing Facebook data. At least one Cambridge Analytica employee worked on the parent company's Saudi project, according to the employee's profile on LinkedIn.

SCL has a long history of quietly helping governments control their populace and wield power. It provided psychological analyses of citizenry in places like Libya under Col. Muammar el-Qaddafi. Last year, it was hired by the government of the United Arab Emirates, a close Saudi ally, to conduct a social media campaign against its rival Qatar. In Indonesia, SCL once "organized avenues of protests" as a means of controlling student demonstrations, according to one news report, and arranged for the government to covertly fund a conference on journalistic independence, according to another.

The company's longtime chief executive, Nigel Oakes, has described its overall strategy as "group communication" that aims to shift the views of large swaths of a population. "We use the same techniques as Aristotle and Hitler," he once said. "We appeal to people on an emotional level to get them to agree on a functional level."

The notion that the company's psychological research played a role in plotting out the Saudi reform efforts could fuel renewed debate about the intentions of the crown prince, Mohammed bin Salman. The prince is variously seen as his region's most important social and economic reformer, a ruthless opportunist or some combination of the two.

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.

The research by the consultancy was taking place against a bleak new reality. Oil fell to below $30 a barrel in 2016 from more than $100 in 2014. That presented severe economic risks in a country where 70 percent of the population is under 30.

SCL's work was circulated among some of the consulting firms developing a plan called Vision 2030, spearheaded by Prince Mohammed, which aims to move the kingdom beyond oil and modernize its culture.

SCL had worked in Saudi Arabia before. It was listed among the countries where the firm had clients on a 2014 PowerPoint presentation obtained by The New York Times. Its most recent work was commissioned by the Saudi Ministry of Economy and Planning, one of the ministries carrying out the Vision 2030 plan.

To what extent the company influenced the kingdom's plans is hard to say. But in Prince Mohammed's telling, winning over the population has been a critical first step.

"There's a lot of challenge," he said in a recent interview on "60 Minutes," in which he acknowledged that the nation's practice of "subsidizing everybody's life" had put it on a path toward financial crisis. "I think the first big challenge that we have is — do the people believe in what we are doing?"