Law360, New York (April 19, 2016, 4:51 PM EDT) — Apple Inc. agreed to pay almost $25 million to settle a lawsuit claiming its Siri program infringed a patent for speech recognition technology on Monday, two weeks before a trial was set to kick off in New York federal court.

Marathon Patent Group Inc. disclosed the $24.9 million settlement in a filing with the U.S. Securities and Exchange Commission. The deal, which includes a patent license for Apple, also comes with a three-year covenant from Marathon not to sue.

The two-week trial had been set to begin in the Northern District of New York on May 2, where jurors would decide whether the Siri personal assistant app on iPhones, iPads and iPods infringed claims in a Rensselaer Polytechnic Institute patent.

Dynamic Advances LLC, a unit of Marathon, is the exclusive licensee of the patent, which covers speech recognition technology that is used to process commands. Siri, which was introduced in October 2011 in Apple’s iPhone 4S, lets users perform various tasks, like sending texts or setting reminders, using voice commands.

Under the settlement, Apple will pay $5 million once the lawsuit is dismissed. It will pay the additional $19.9 million once RPI agrees to the license or the court decides Dynamic Advances has the authority to grant the license. The additional payment could also be triggered by the suit being dismissed with prejudice or the patent either expiring or being found invalid.

A spokesman for Marathon declined to comment beyond what was in the public filings. Apple representatives did not immediately respond to a request for comment.

RPI and Dynamic Advances initially sued Apple in 2012 over the alleged infringement, seeking an undisclosed amount in royalties, as well as a permanent injunction to stop Apple from infringing the patent further.

Apple defended the suit by arguing, among other things, that it didn’t infringe because Siri doesn’t work the same way as the claimed invention. More technically, it said the patent describes a specific way to use natural language to interface with a so-called enterprise database. It said Siri is not an interface to an enterprise database.

“Siri’s vocabulary spans millions and millions of words, something the [patent] seeks to avoid and cannot handle,” it wrote in a partially redacted motion last spring.

“Because Siri is not an interface to any particular database,” it continued, “Siri’s natural language processing does not use a metadata database with information about the database to be queried as all the claims of the [patent] require.”

The court, though, was apparently not convinced and in January denied Apple’s request for a favorable judgment in the case. The ruling was sealed, but records show a similar request from Dynamic Advances was also denied that day.

In a statement released shortly after the court’s ruling, Dynamic Advances’ parent company revealed that its expert had calculated an appropriate damages award, if Apple were found to have infringed, would be between $175 and $200 million.

On Tuesday, both sides asked the judge overseeing the case to dismiss the suit on account of the settlement.

The plaintiffs are represented by James R. Muldoon and Steven P. Nonkes of Harris Beach PLLC; and Paul J. Skiermont, Donald E. Tiller, Alexander E. Gasser and Shellie Stephens of Skiermont Derby LLP.

Apple is represented by Jeffrey A. Ware, David M. Lacy Kusters, Ryan J. Marton, J. David Hadden, Hector J. Ribera, William A. Moseley Jr. and Carolyn Chang of Fenwick & West LLP; and Mitchell J. Katz of Menter Rudin & Trivelpiece PC.

The case is Dynamic Advances LLC v. Apple Inc., case number 13-cv-00633, in the U.S. District Court for the Northern District of New York.

— Additional reporting by Vin Gurrieri. Editing by Kelly Duncan.