A federal jury on Tuesday upheld the validity of two Merck patents in a dispute with Gilead Sciences, which could be forced to hand over a portion of the billions of dollars in revenue from its blockbuster cure for hepatitis C.

The verdict in federal court in San Jose, Calif., is a setback for Gilead, whose drugs Sovaldi and Harvoni brought in $19.2 billion in worldwide sales last year. Merck has demanded more than $2 billion in damages and a royalty of 10 percent of Gilead’s sales going forward. The jury must now decide exactly how much Gilead owes.

Gilead shares were down $1.92 to $91.80 in after-hours trading. Merck rose 57 cents to $53.60.

In a statement, a Gilead spokeswoman, Michele Rest, said, “Although we are disappointed by the jury’s verdict today, there are a number of remaining issues to be decided by the jury and the judge.”

A spokeswoman for Merck said the verdict “accurately reflects the evidence in this case,” adding that strong patent protection is essential to innovation.