Image copyright Getty Images Image caption Taylor Swift is due to be awarded Artist of the Decade at Sunday's American Music Awards

"I don't know what else to do," declared Taylor Swift in a lengthy Twitter post last week. "I just want to be able to perform my own music."

The star was distressed and upset. She wanted to play a medley of her hits at Sunday's American Music Awards but her old record label had forbidden it.

Or so she claimed. The label hit back with a statement of its own, saying it hadn't tried to stop the show and that Swift's narrative "does not exist".

Insults were traded, politicians weighed in and, eventually, a settlement was reached.

Big Machine Records issued a statement on Monday night saying it had agreed "to grant all licences of their artists' performances" for "the upcoming American Music Awards".

It didn't mention Swift by name but the implication was clear: Her performance could go ahead.

But the second half of the statement was the really interesting part.

"It should be noted," said the label, "that recording artists do not need label approval for live performances on television or any other live media.

"Record label approval is only needed for contracted artists' audio and visual recordings and in determining how those works are distributed."

Image copyright Twitter / HSpalding13 Image caption Taylor Swift's fans paid for billboards supporting the star to appear outside the headquarters of Big Machine Records

In other words, Swift never needed permission to play hits like Shake It Off, Love Story or I Knew You Were Trouble at the AMAs (in any case, performance rights belong to the publisher, not the record label).

What she couldn't do was put them online afterwards. And that matters.

Last year, 6.5 million viewers tuned in watch the AMAs on television, down from 9.15 million a year earlier, but clips from the show went viral.

Cardi B's carnivalesque performance of I Like It has racked up 28m views on YouTube alone, for example - making that platform more valuable to her as an artist than the TV broadcast itself.

Taylor Swift obviously wants her performance archived online, too... but that's where things get tricky.

"If Taylor was performing her own songs live at a festival, which wasn't being broadcast, it wouldn't be a problem," leading music and entertainment lawyer Talya Shalson tells the BBC.

"The issue in this situation is that, as it's a recorded performance, that would effectively be a re-recording" of the star's biggest hits.

"It's very common for labels to put in a re-recording restriction, which normally lasts three or five years after the end of the artist's deal," she explains.

Such a clause prevents the artist from taking their songs, recording them again and delivering them to another label, allowing the original rights-holder to "protect its investments".

Image copyright Getty Images Image caption Scooter Braun (left) with Swift's arch-nemesis Kanye West. Braun now owns the rights to Swift's first six albums

A crucial bit of background to this story: Swift fell out with Big Machine in June this year, after the label was bought by Justin Bieber and Ariana Grande's manager Scooter Braun for $300 million.

Swift made no secret of her dismay. One of Braun's on-and-off clients is Kanye West, who has tormented Swift for more than a decade, interrupting her at award shows, disparaging her in his songs and putting a waxwork of her naked body into a music video.

Swift believes Braun encouraged and endorsed some of those actions, which is why she issued an impassioned statement this summer, saying she felt "sad and grossed out" by Braun taking control of her back catalogue, including every album she released up to 2017's Reputation.

She called the deal "my worst case scenario" that "stripped me of my life's work"; but later announced plans to re-record all of her old music, undercutting the value of the master tapes held by Braun and his investment company Ithaca Holdings.

Speaking to Good Morning America over the summer, she revealed the process would begin next year.

"My contract says that starting November 2020, I can record albums one through five all over again," she said.

"I think it's important for artists to own their work," she continued. "I'm gonna be busy, I'm very excited."

(Coincidentally, she played Shake It Off during the same TV appearance, apparently without any restrictions from Big Machine.)

Swift wouldn't be the first artist to record "forgeries" of their biggest hits: TLC, Prince and Def Leppard have all used the tactic to regain control of their music.

But her plans apparently spurred last week's tussle. In her initial statement, Swift said she'd been told the AMA medley could go ahead if she "agreed not to record copycat versions of my songs next year".

As leverage, Big Machine seemed willing to classify any archive of the performance as a "new master recording", putting Swift in breach of her contract.

But that is a "technical argument" which "to my knowledge, is not a position that a label has taken before," says music industry lawyer Susan Genco.

She describes Big Machine's original stance as "counter-intuitive and against the label's interest" because, if millions of people see Swift play on Sunday, they're likely to go out and stream her back catalogue, boosting the label's profits.

In that light, the decision to halt the performance seems misguided at best; vindictive at worst.

It's an ugly story, and one that's as old as the music industry itself: A young artist signs a restrictive contract at the start of their career, and only becomes aware of the consequences when it's too late.

In this case, Swift was able to mobilise her fans, who paid to erect #IStandWithTaylor billboards outside Big Machine's offices in Nashville; and the media, who covered the fall-out in blow-by-blow detail, until she got the outcome she wanted (although a planned Netflix documentary is still in dispute).

As an added bonus, a lot more people now know that Swift is performing at the American Music Awards this weekend, where she is due to receive the Artist Of The Decade award.

As Van Morrison once put it: "Music is spiritual. The music business is not."

Follow us on Facebook, or on Twitter @BBCNewsEnts. If you have a story suggestion email entertainment.news@bbc.co.uk.