Apple (AAPL) and Nokia (NOK) have gone from being sworn enemies to business partners for the second time in six years. After months of battling it out in court over yet another patent​ dispute, the two companies, which have a fiery history of technology-related lawsuits, reached an agreement that will see them join forces once again.

The two companies have agreed to settle all litigation related to their intellectual property dispute, and under their latest multi-year licensing partnership, Nokia has agreed to provide network infrastructure services to Apple, in return for an undisclosed up-front cash payment and additional revenues. The agreement also means that Apple will resume selling Nokia’s digital health products, which it stopped distributing in December 2016 after learning that Nokia had sued it for patent infringement. (See also: Behind Nokia's 70% Drop in 10 Years.)

In a joint press release, the two companies added that they are also “exploring future collaboration in digital health initiatives.”

“This is a meaningful agreement between Nokia and Apple,” said Maria Varsellona, chief legal officer at Nokia. “It moves our relationship with Apple from being adversaries in court to business partners working for the benefit of our customers.”

Apple’s chief operating officer Jeff Williams chipped in with the following: “We are pleased with this resolution of our dispute and we look forward to expanding our business relationship with Nokia.”

The latest hostilities between the two companies flared up after Nokia sued Apple for allegedly violating 32 technology patents that, among other things, were linked to displays, user interfaces, software, antennas, chipsets and video coding used across Apple products, including the iPhone, iPad, Apple Watch, Apple TV and Mac computers. Nokia’s lawsuit came shortly after Apple accused the Finnish company, which was once a dominant leader in the cellphone market before the arrival of the iPhone in 2007, of extorting exorbitant revenues for its panted technology. 

Incidentally, the two companies also sued each other back in 2009. A truce was eventually called in 2011 after Apple agreed to make a one-time payment and pay regular royalties to the Finnish company.