Pfizer Inc. has reached a settlement with Teva Pharmaceuticals that allows the generic drugmaker to launch a copycat version of its popular erectile dysfunction drug Viagra in 2017.

Pfizer said Tuesday that Teva will pay an undisclosed royalty for a license to produce a generic version of Viagra, one of New York-based Pfizer’s best-selling drugs. Viagra generated about $1.14 billion in U.S. sales last year and more than $2 billion worldwide.

Pfizer’s patent protecting Viagra from generic competition expires in April 2020, but Teva Pharmaceuticals USA Inc. will be allowed to launch its generic version in the United States on Dec. 11, 2017. Teva Pharmaceuticals USA is a division of Israeli-based Teva Industries Ltd.

Pfizer Inc. had sued Teva in 2010 over the drugmaker’s plans to introduce a generic version of Viagra. Drugmakers fight to protect patents because sales of their drugs plunge after cheaper, generic competition enters the market.

For instance, Pfizer lost U.S. patent protection for the cholesterol fighter Lipitor, which was once the world’s top-selling drug, in November 2011. U.S. revenue from that drug plummeted from $5 billion in 2011 to about $932,000 last year.

Other drugmakers also are dealing with a wave of patent expirations that have hurt their revenue. The patent protecting another erectile dysfunction drug, Eli Lilly and Co.’s Cialis, also expires in 2017.