Apple and Qualcomm have agreed to settle all ongoing lawsuits, putting an end to the blockbuster legal battle that’s seen the two tech giants sue one another across the globe.

As part of the settlement, Apple will make a payment to Qualcomm for an undisclosed amount. The companies have reached a six-year global patent licensing agreement, which may be extended for another two years. They’ve also agreed for Qualcomm to supply parts to Apple for multiple years, which likely means its modems will once again appear in the iPhone.

Opening arguments in the trial hadn’t even wrapped up

Apple and Qualcomm have been fighting over Qualcomm’s patent licensing practices for the last two years. Apple contended that Qualcomm was charging unreasonably high fees for essential patents and using its position as the dominant supplier of smartphone modems to demand those exorbitant prices. For Qualcomm, there was a lot at stake, including patent licensing accounts for the vast majority of its profits.

The lawsuit began in January 2017, and the two companies just entered court this week. Word of the settlement came while the two companies were still reading their opening arguments.

Qualcomm has been sued over licensing practices and monopolistic behavior by regulators across the globe. In the US, it’s still waiting on the results of the lawsuit it fought against the Federal Trade Commission in January, which was filed just days before Apple’s. The company has been fined hundreds of millions of dollars over those practices, which initially suggested that Apple may have the upper hand.

But in recent months, Qualcomm has managed to put pressure on Apple. It managed to win iPhone bans in Germany and China over patent violations, and it won a lawsuit in the US that put a high price on just a small number of its patents. More wins for Qualcomm could have ended up raising the price for Apple, which may have made the company more inclined to settle.

The two companies may have also wanted to avoid spilling secrets publicly in court. Executives from both companies were preparing to testify, and already, both sides were claiming to have some dramatic details. Qualcomm said Apple had been plotting this legal showdown for years, and in a separate lawsuit, it accused Apple of stealing its technology.

The agreement means the two companies can return to business as usual for the next six or more years. For the most recent iPhones, Apple relied exclusively on Intel to provide the devices’ modems since it couldn’t reach an agreement with Qualcomm. In the future, it sounds like Qualcomm parts will make a return. Apple usually splits modem orders between the two companies.

Qualcomm’s modems have consistently remained ahead of Intel’s when it comes to speed. While Apple hasn’t taken advantage of those performance improvements, it may be interested in something else Qualcomm has: 5G modems. Qualcomm already has some on the market, while Intel’s remain in development. (The settlement is generally bad news for Intel, which had finally experienced something of a breakthrough in its modem business, thanks to this legal fight.)

Apple and Qualcomm’s legal battle had the potential to reshape pricing around modems as a critical time in the mobile phone market just as 5G is starting to take shape. If Apple had won, it could have secured lower prices for itself and potentially made it easier for competitors to Qualcomm to build their own alternatives. If Apple had lost, Qualcomm may have been able to secure even higher fees going forward, further taking hold of the modem market amid a generational change.

For both sides, the stakes may just have been too high.