Last week, Kesha's legal battle with the producer she says raped and sexually abused her suffered a big setback. But behind Kesha's court fight with producer Lukasz Gottwald, known as "Dr. Luke," the singer-songwriter is also engaged in a battle with a more mercurial enemy.

You could call it "the power of capital." But it's basically the network of laws and legal contracts that structure a lot of what we call "wealth."

In 2005, when Kesha — whose full name is Kesha Rose Sebert — was 18, she signed with Gottwald's company in Los Angeles so he could produce her songs. Four years later, in 2009, Gottwald negotiated a deal to distribute Kesha's music under Sony's umbrella. Then in 2014 Kesha sued Gottwald for sexual assault, battery, and sexual harassment. According to her allegations, the abuse began almost as soon as she started working with him. On at least one occasion, Gottwald drugged and raped her, she says.

The case is ongoing. But last week, New York Supreme Court Justice Shirley Kornreich denied Kesha a preliminary injunction, which would have allowed her to break her contract with Gottwald and work under Sony's umbrella without any connection to Gottwald's specific companies.

Details made public about the contract are eye-popping: Kesha is required to deliver six more albums, which could tie her to Gottwald's company for another 12 years. What's even more stunning is that these terms are not unusual. As Melinda Newman explained at Forbes, record labels routinely sign artists and acts for one or two initial albums, with an option to sign them for five more. Such deals can tie up an act up for 20 years, depending on how long it takes to make the albums.

From a simple human perspective — when you imagine the amount of work that goes into writing, recording, promoting, and touring for an album, and all the other publicity — it's an extraordinary commitment to ask of a human being whose life can always take unexpected turns. Indeed, Newman pointed out that California law explicitly limits these sorts of personal services contracts to 7 years.

The one exception — thanks to a massive lobbying push by the recording industry — is recording artists like Kesha.

Nor are incredible demands in contracts just a problem for famous music artists. Companies have been flexing their muscles across the American economy to see what they can get away with, imposing things as ridiculous as noncompete clauses on camp counselors and the low-wage workers who make you sandwiches.

Now, Kesha filed her initial suit in California. But Sony is based in New York, so it's not clear how the statutes apply. But it's a reminder of the enormous power record labels can still wield over artists. For all intents and purposes, these sorts of contracts turn an artist into a kind of human financial instrument: a guaranteed long-term stream of income for the contract holder. Indeed, a crucial part of Gottwald's argument was that he's already "invested" anywhere from $11 to $60 million in Kesha's career. Losing that return on investment would do his company "irreparable harm" under Kornreich's reasoning.

That logic is also the implicit metric against which Kesha's claim was being measured when Kornreich decided that forcing her to abide by the contract would not do her "irreparable harm" in turn.

"You're asking the court to decimate a contract that was heavily negotiated and typical for the industry," Kornreich told Kesha's lawyer. Noting the lack of evidence for the assault charges — a grim he-said-she-said quandary into which these sorts of cases often fall — the judge said that, "I don't understand why I have to take the extraordinary measure of granting an injunction."

"My instinct is to do the commercially reasonable thing," she added.

Kesha's case is far from over, and Sony is already offering to work out an arrangement in which she can continue recording without Gottwald's direct involvement. But thanks to the structure of her contracts, the people Kesha would be working with would ultimately still report to Gottwald, placing her fate and career under his supervision. The singer-songwriter's best hope may lie with her fans and general public outcry, which could force Sony to offer Kesha better terms to save its brand image.

Point being, these sorts of contracts aren't fixed forces of nature by which we must all abide; they're just social agreements. As California's attempt to step in and set limits on personal service contracts highlights, there's an inherent, subjective malleability to the whole thing.

"I think if the judge really believed [Kesha's allegations against Gottwald], the judge would find a way to relieve Kesha of the obligations," Southwestern Law School professor John Heilman told Vox.

If we want to step in and limit the scope of these contracts — to make them answerable to the demands of basic human decency — we can do that. We just have to decide, as a society, that we want to.