Caitlin Rosenthal is assistant professor of History at the University of California, Berkeley and author of "Accounting for Slavery: Masters and Management."

The past six months have been brutal for McKinsey & Co., a storied consultancy where I spent my first years after college. A barrage of negative headlines have accused the firm of raising the stature of authoritarian governments, working with ICE (ended after outcry from firm alumni) and failing to advise a client not to use a business partner engaged in bribery. Most recently, reporting revealed that the firm had advised opioid maker Purdue Pharma on how to “turbocharge” sales.

The stories share a common thread: None of them implicate McKinsey directly. Rather, they point to illegal and unethical behavior a few steps away — behavior that McKinsey overlooked or supported. McKinsey’s official response to one of the articles suggested that the firm was being held to a uniquely high bar, that it had been declared guilty by proximity.

In a sense this is true, but this line of thinking exposes a common flaw in business ethics. It’s remarkably easy to overlook massive moral transgressions when you are doing business from a distance, reviewing entries in a spreadsheet or numbers in a presentation.

My time at McKinsey inspired me to study the history of quantitative management and the ethical challenges it creates. What happens when firms like McKinsey parachute into new companies to crunch data and offer advice?

Surprisingly, the history of American and Atlantic slavery offers insight into this question. Running a slave plantation involved lots of data carefully entered into paper spreadsheets and reports that were passed along to absentee owners in England. From the comfort of counting rooms, plantation owners could review this data without having to think too hard about the people it represented.

Some planters received standardized reports every month from their sugar plantations in Jamaica and Barbados. These careful records tracked the daily tasks of the hundreds (sometimes thousands) of people they enslaved, all with an eye to maximizing profits. The accounts monitored the output of plantations as well as the “increase” and “decrease” of laborers, slaveholders’ chilling economic shorthand for births and deaths.

When you understand the context of these records — high mortality, punishing slave labor, racialized violence — the records are horrifying. But without that context, they erase as much as they reveal. They look like antiquarian versions of Excel spreadsheets. And, absent a moral perspective, the productivity enabled by data-driven analysis could be seen not as a marker of degradation but of progress.

Planters in the American South also entered data into early versions of spreadsheets. The most sophisticated among them monitored enslaved people’s productivity in gridded journals, collecting data on the pace of cotton production. They tracked cotton picking on an individual basis, weighing output as many as three times per day. The surviving account books from these plantations contain thousands of data points. Even as the data illuminated productivity, it obscured other aspects of plantation life. It hid the immense human costs of slavery.

Plantation owners could pore over data looking for opportunities to tweak production and increase profits without thinking much about the violence of the system. In a sense, slaveholders’ reports were dashboards that synthesized information into “key performance indicators” so that owners could monitor assets from afar. They could manage assets and maximize value without considering the horrifying violence of plantation life. They could calculate how to accelerate production without considering the exploitative conditions that made this speedup possible. Or ponder how to increase efficiency without dwelling on the synergies between their calculations and the overseer’s whip.

The ease with which this happened offers a cautionary tale for modern business. It is all too easy to overlook and excuse immoral contexts. When consultants arrive at clients’ offices, they scoop up data and parse it to make recommendations. They analyze spreadsheets full of numbers that represent people — people whom, for the most part, they will never meet.

Considering data at a distance makes it perilously easy to overlook the stories the data does not tell. What would a strategic management consultancy have done if they had been handed the data of wealthy slaveholders? Would they have suggested ways to tweak profits? Or perhaps recommended lobbying Congress to prevent abolition? Hopefully not.

But history suggests making the right decision in circumstances like this is immensely difficult. It requires looking beyond the data and considering the broader context. It also means turning down profitable work. Doing well and doing good don’t always go together.

McKinsey may be beginning to understand this. In response to a scandal in South Africa last year, managing partner Kevin Sneader promised to “really work” to “make sure we’re on the right side of change.”

If being on the right side of change is really the goal, then history can help. Beyond the history of slavery, business leaders contemplating when to work with authoritarian governments may also want to read some of the extensive literature on companies that did business with Nazi Germany. And anyone working in contexts plagued by corruption will find parallels and precedents in the history of fraud.

Working in contexts where illegal and unethical behavior is common may be tempting, offering big payouts and occasionally even the promise of making things better. But there are major risks — threats to profits and, more important, values. Studying businesses that were on the wrong side of history can help to navigate these risks.

These aren’t just risks for consultancies: With easier access to data and rapid communication, more businesses are managing production from great distances.

Without feeling the human costs of data-driven decisions, it’s as easy for modern managers and investors to recommend firing workers, paying them less than a living wage or offering strategies for selling more dangerous, addictive opioids as it was for enslavers to recommend business practices built on bondage.

McKinsey is being held to a high bar, and the firm must rise to it. This will require a reconsideration of firm values, including the limits of “client service.” This is the item at the top of McKinsey’s list of values, specifically, putting “client interests ahead of the firm’s.” This phrase has the feel of selflessness, but it should not be mistaken for an ethical standard. Client service is not public service, especially when the client is doing harm. In the 21st century, a truly great consultancy will figure out how to help businesses while also maintaining “high ethical standards” — the second value on McKinsey’s list.

My time at McKinsey convinced me that consulting can do good. It also convinced me that McKinsey is a place where the bottom line isn’t always financial: a firm with a long history that also cares about being on the right side of history. I hope I am right.