Apple and Qualcomm have agreed to settle their long-running patent dispute, both companies announced Tuesday. The agreement effectively ends all lawsuits between the two companies; Apple will license Qualcomm’s chips for 6 years, and also agree to pay a one-time undisclosed payment for past use of Qualcomm’s technology.

News of the settlement came just as the case between the two companies was heading before a jury San Diego, Calif.

Qualcomm and Apple had been fighting in courts around the world for years. Qualcomm, in essence, was arguing that Apple wasn’t compensating the company for the use of its intellectual property; Apple on the other hand had been alleging that Qualcomm was using invalid patents to demand royalty payments for the use of wireless chipsets.

While these lawsuits never ended the business relationships between the two companies, they did have some real impacts on Apple’s business. Late last year, Apple had to update its phones in China to prevent a sales ban. Around the same time, the company was forced to stop the sale of older iPhones in Germany.

At the same time, Qualcomm was coming under pressure after multiple courts sided with Apple; a decision that would have invalidated Qualcomm’s patents could have resulted in a fatal blow for the company’s chipset licensing business.

Investors sent Qualcomm’s share price up more than 20% on the news Tuesday, while Apple’s stock stayed effectively flat.