For most of McKinsey & Company’s nearly hundred-year history consulting for companies and governments around the world, the firm has enjoyed a reputation for discretion and professionalism in its work. Its name evokes a certain mystique: hiring McKinsey telegraphs to employees and competitors that a company is serious about tackling a particular problem—whether it involves reorganizing its business, cutting costs, or launching a new line of products—and that the company is willing to spend millions of dollars for the most sophisticated advice. At the same time, part of what makes McKinsey different from other firms is its insistence that it not be acknowledged for its work; a client often agrees not to publicly disclose the fact that it has hired McKinsey. Part of what the firm is selling is credit for its ideas, in addition to the ideas themselves. “If McKinsey has a great idea and you follow their advice and everything works out, you never see McKinsey running around saying, ‘That was our idea,’ ” Duff McDonald, the author of “The Firm: The Story of McKinsey and Its Secret Influence on American Business,” told me. “But at the same time, part of the sale is that they take no responsibility for the result. They are saying to the client, ‘You can have all the credit you want, but you cannot push a bad outcome on us.’ ”

The limitations of this model came into sharp focus recently, with the revelation that McKinsey may have inadvertently played a role in Saudi Arabia’s mistreatment of critics. On October 20th, the Times reported that the government of the Saudi crown prince, Mohammed bin Salman, had employed operatives to harass dissidents, including the Saudi journalist Jamal Khashoggi, who was allegedly murdered inside the Saudi consulate in Istanbul, on October 2nd. The article included the revelation that McKinsey had prepared a nine-page report measuring the public perception of certain Saudi economic policies, and cited three individuals who were driving much of the largely negative coverage on Twitter: a Saudi Arabia-based writer named Khalid al-Alkami, a dissident living in Canada named Omar Abdulaziz, and an anonymous writer. After the report was created, Al-Alkami was arrested, and Abdulaziz’s brothers living in Saudi Arabia were put in prison. The anonymous Twitter channel was shut down.

The condemnation of McKinsey’s decision to do work for Saudi Arabia’s autocratic leadership was swift. (Disclosure: The New Yorker has worked with McKinsey in the past.) In a statement posted on Twitter in response to criticism, the company said that the Saudi state had not commissioned it to create a report that identified critics. “In our work with governments, McKinsey has not and never would engage in any work that seeks to target individuals based on their views,” the firm said. “The document in question was a brief overview of publicly available information looking at social media usage,” and “its intended primary audience was internal.” The firm said that it was “horrified” by the possibility that its work could have been misused, and that it was investigating how the report could have got into the hands of people who were not supposed to have it.

There is still much to learn about McKinsey’s role in the episode, and it may well turn out to be less nefarious than it first appeared. But in the last few years, the firm, which likes to stay out of the news, has become embroiled in several unsavory engagements. Taken together, the incidents highlight the fact that McKinsey’s commitment to working with almost anyone who will pay its lavish fees, from China to dozens of departments in the U.S. government, while disavowing any responsibility for what clients do with the information that it supplies, can lead to unacceptable levels of moral compromise. “I think, by the very nature of the business, they are mercenaries—they will work for anyone,” McDonald said. “I don’t mean they’ll work for a murderer. But they’re for hire.” Referring to McKinsey’s tradition of recruiting students right out of business school, he noted, “The M.B.A. is a corporate soldier willing to work for the highest bidder. . . . And if you pledge loyalty to no one in particular, and insist on your right to work with everyone, then ultimately it could become a leadership nightmare.”

The most disturbing of these recent cases involves McKinsey’s controversial entanglement in South Africa. In 2015, according to reporting in the Times, the firm signed a contract worth up to seven hundred million dollars to provide consulting services to Eskom, the state-owned power company. It soon became clear that McKinsey had partnered on the project with a firm linked to Ajay, Atul, and Rajesh Gupta, three brothers whose business dealings were at the center of a far-reaching corruption scandal—they are alleged to have used their personal connections to former President Jacob Zuma to manipulate the government for personal gain. (Zuma resigned early this year, partly as a result.) Facing international criticism, McKinsey denied any legal wrongdoing, but acknowledged that it had made misjudgments. The firm replaced the management of its South African office and pledged to repay the seventy-four million dollars that it had received from the government. “This isn’t who we are,” Dominic Barton, the firm’s managing director, told the Times. “It isn’t what we do.”

This summer, in the midst of protests over the Trump Administration’s immigration policies, it came to light that McKinsey was working with the U.S. Immigration and Customs Enforcement agency. The firm said that its contract was for a “long-term program” at the agency, and that it was not involved in implementing immigration policy. When the firm’s engagement with ICE became public, it reportedly prompted heated discussion among current and former McKinsey employees. This corporate dynamic seems to have become more common recently; earlier this year, Google employees protested the fact that their employer had agreed to provide artificial-intelligence services to the Pentagon, prompting the company to withdraw from the deal. (Last week, Microsoft quietly announced that it had agreed to provide A.I. to the military.) In July, McKinsey’s contract with ICE, which began in 2016, ended as scheduled. The firm would not “under any circumstances, engage in any work, anywhere in the world, that advances or assists policies that are at odds with our values,” the firm’s managing partner wrote in a note to McKinsey employees. McKinsey has had several subsequent moments of notoriety. This fall, for example, the Times reported that the firm was advising Puerto Rico on managing a hundred and twenty-three billion dollars’ worth of debt, while also investing in some of that debt—an arrangement that posed a possible conflict of interest. McKinsey had received fifty million dollars in fees for the assignment as of September. (A spokesperson at the time said that McKinsey had met all legal requirements, “including those regarding potential conflicts.”) After each episode, there was public scrutiny—in some cases, an apology—and then business continued largely as usual.

These kinds of problems have arisen, in part, because McKinsey is so successful. It has greater access and influence than most other management-consulting firms, and this puts it in a position to see its work misused. There is little external oversight of a company like McKinsey, from either review boards or federal regulators. At a time when accountability is declining in both the U.S. government and corporate America, we are left asking the people at the firm to impose it on themselves. “Who do they answer to?” McDonald asked. “They work for the F.B.I., the D.O.J., for ICE, for Puerto Rico. They work for all the big banks. They work for everyone. It’s transnational.” He went on, “So something like South Africa happens. Who punishes a firm of their size and influence over something like that? McKinsey is so connected and so influential all over the planet, it’s kind of interesting to think about. Who’s the entity that says, ‘What are you doing?’ Apparently no one.”

A previous version of this article inaccurately summarized reporting by the New York Times.