Forest Laboratories ( FRX) has settled a patent dispute involving the antidepressant Lexapro, its best-selling drug.

The agreement with the Australian generic drug company Alphapharm doesn't affect the Lexapro patent fight with Miami-based Ivax ( IVX). The Ivax dispute goes to trial Dec. 5, and this is the most significant danger for Forest.

Investor interest in the Lexapro patent matter is so intense that Ivax issued a press release Wednesday "in response to rumors," saying that it was "not currently in discussions" with Forest over the drug. "Ivax believes it has valid claims against the Lexapro patents," the company said.

The stakes are enormous for Forest, which has suffered several research setbacks this year. For the three months ended June 30, Lexapro accounted for $460 million of the company's $674.7 million in sales.

If Forest defeats Ivax, it would enjoy at least four more years of Lexapro patent protection and perhaps as much as six extra years, says Ken Kulju of UBS Securities, in a Thursday research report to clients. "This is positive news for Forest, as it reduces litigation risk," says Kulju, who is neutral on the company.

"We believe the Lexapro patents will stand and Forest will prevail in the Ivax case," he adds. Kulju doesn't own shares of Forest, but his firm is a market maker in the stock.

Thursday's settlement with Alphapharm is "a minor positive," adds Marc Goodman of Morgan Stanley, in a research note upholding his equal-weight rating on Forest. "The bigger risk is obviously still the Ivax suit." He doesn't own shares, and his firm has had an investment-banking relationship in the last 12 months with Forest.

The deal means Alphapharm, which is owned by the German chemical and drug giant Merck KGaA, acknowledges the validity of the key Lexapro patent.

In return, Forest gives Alphapharm exclusive rights to sell generic Lexapro under certain circumstances -- two weeks before the patent expires, if an appeals court rules the patent invalid or unenforceable, or if another company starts selling a generic copy before a final court ruling.

The agreement also was signed by Danish drug company H. Lundbeck, which licenses Lexapro's U.S. marketing rights to Forest.

The agreement with Alphapharm is another example of "authorized generics," a practice by which a company gives a generic drugmaker a license to sell a copycat version of a brand-name product. The strategy gives the brand-name maker some extra revenue when its drug loses patent protection.

Additionally, the move cuts in to the sales of a competing generic company -- in this case, Ivax -- that claims "first-to-file" status. When a brand-name drug loses patent protection, the Food and Drug Administration says the first company filing a proper generic drug application gets 180 days of marketing exclusivity for its product.

Shares of Forest rose 39 cents to $37.99 after having moved as high as $38.39. Shares of Ivax slipped 14 cents to $26.82.

More from Stocks

Finding Stocks Right for You: Cramer's 'Mad Money' Recap (Friday 8/25/18)

Finding Stocks Right for You: Cramer's 'Mad Money' Recap (Friday 8/25/18)

Flashback Friday: Amazon, Chip Stocks, Memorial Day

Flashback Friday: Amazon, Chip Stocks, Memorial Day

Week Ahead: Wall Street Looks to Jobs Report as North Korea Meeting Less Certain

Week Ahead: Wall Street Looks to Jobs Report as North Korea Meeting Less Certain

Dow and S&P 500 Decline, Energy Shares Fall as U.S. Crude Oil Slides 4%

Dow and S&P 500 Decline, Energy Shares Fall as U.S. Crude Oil Slides 4%

Replay: Jim Cramer on the Markets, 10-Year Yield, Oil Prices and Foot Locker

Replay: Jim Cramer on the Markets, 10-Year Yield, Oil Prices and Foot Locker