Apple has been dealt a major blow in its ongoing trial against Fortnite-maker Epic Games.
A court in Oakland, California, has ruled that Apple cannot stop app developers directing users to third-party payment options.
Apple had argued that all apps should use Apple's own in-app payment options.
In a high profile trial, Epic Games had challenged the up-to-30% cut Apple takes from purchases - and argued that the App Store was monopolistic.
On Friday, Judge Yvonne Gonzalez-Rogers ruled that "the court cannot ultimately conclude that Apple is a monopolist".
However she also issued a permanent injunction, stating that Apple could no longer prohibit developers linking to their own purchasing mechanisms.
For example, a movie-streaming service will now be able to tell customers to subscribe via its own website, without using Apple's in-app purchasing mechanism.
Epic has also taken legal action against Google over its Play Store.
Apple's closed payments system is hugely lucrative for the tech giant, although the company says it does not know exactly how much it makes.
The ruling effectively states that Apple cannot ban developers from communicating with customers. Often there are cheaper options for consumers away from the App Store, however Apple did not allow companies to tell consumers this.
Epic had argued that this was unreasonable and that developers should be able to inform users that they could make purchases away from the App Store.
However in a win for Apple, the judge also ruled Epic failed to demonstrate Apple was operating an illegal monopoly.
Judge Yvonne Gonzales-Rogers said: "Apple enjoys considerable market share of over 55% and extraordinary high profit margins."
But added: "These factors alone do not show antitrust conduct. Success is not illegal."
A spokesperson for Apple said: "Today the Court has affirmed what we've known all along: the App Store is not in violation of antitrust law.
"Apple faces rigorous competition in every segment in which we do business, and we believe customers and developers choose us because our products and services are the best in the world."
Epic Games' chief Tim Sweeney said the ruling was "not a win for developers or consumers" and vowed to "fight on".
Today’s ruling isn't a win for developers or for consumers. Epic is fighting for fair competition among in-app payment methods and app stores for a billion consumers. https://t.co/cGTBxThnsP— Tim Sweeney (@TimSweeneyEpic) September 10, 2021
Music streaming site Spotify said: "We are pleased with [the decision that] Apple engaged in anti-competitive conduct and has permanently prohibited their anti-steering provisions."
The ruling also revealed that gaming apps account for 70% of App Store revenue.
It's likely the decision will be appealed, perhaps by both sides.
Apple's share price has fallen by 3% since the decision, wiping billions of dollars from its valuation.
A complex decision - with no clear winner
Apple has been quick to claim victory - calling it a "resounding win".
It is true that the judge mainly sided with Apple on Epic's major contention, stating it is not a monopoly.
However the characterisation that Apple has "won" here is misleading.
Epic's case against Apple was speculative. Many believed they didn't stand a chance.
That the court has moved to allow in app purchases to be redirected away from the App Store could be a major blow to Apple's business model.
It was revealed that 70% of Apple's App Store revenue comes from gaming apps - an astonishing figure.
I say "could be" because it's unclear how many people would choose to purchase away from the App Store, or to what extent that would dent Apple's profits.
During the trial, Apple's CEO Tim Cook said he didn't know how much the company generates from the App Store. That makes trying to assess the damage this ruling could have on the company difficult.
Epic is saying it is disappointed in the ruling, and certainly the judge could have given them more.
But the decision has been welcomed by anti-trust campaigners, who believe Apple use their market dominance to bully developers.