Being the first company to file for approval of a generic drug -- thereby getting six months of marketing exclusivity -- is one of the biggest sources of profits for makers of generics. Filing an abbreviated new drug application can also be a risky prospect if the drug's patent is still valid, because inevitably the drug's developer ends up suing to protect sometimes shaky patents.

On Wednesday, shares of Celgene (NASDAQ:CELG) were down almost 8% at one point after it said that Barr Pharmaceuticals (NYSE:BRL) had filed an abbreviated application to market a generic version of its top drug, Thalomid, used to treat multiple myeloma (cancer of the bone marrow) and leprosy.

There's a lot at stake for Celgene and Barr because in the first nine months of this year, Thalomid accounted for more than 50% of Celgene's revenues. Sales have grown 15% over the same time last year to $323 million thus far in 2006, so any prospect of generic competition would be a big hit to Celgene's sales and earnings.

Now that Celgene has announced it intends to sue Barr over its Thalomid application, Barr won't be able to market the generic, even if it's approved, until either the patent infringement suit is resolved in Barr's favor or 30 months go by without a decision -- whichever occurs first.

Because I haven't practiced patent law, it's unclear to me who will win in the courts. Thalomid has been a known molecule for decades but has been approved for use in the U.S. only since 1998 and was granted orphan drug status, giving it seven years of marketing exclusivity when it was approved to treat Hansen's disease, or leprosy. It was also approved to treat multiple myeloma this year, so that may affect how long there is market exclusivity for Thalomid, too.

This abbreviated application is only an opening salvo in Barr's challenge to Celgene's Thalomid patents. There's still plenty of time before this case works its way through the courts, but it could be a good move for Barr, considering the millions of dollars up for grabs and that a new generic drug can command 80% to 90% of a branded drug's price.

Need new ideas for your money? Take a risk-free look at Stocks 2007 , our analysts' top picks for the new year.

Fool contributor Brian Lawler owns shares of Barr but of no other company mentioned in this article. The Fool has a disclosure policy.