An administration official said it would be too disruptive to change the longstanding patent policy now, since the court might end up ruling the other way on the case involving the cancer risk genes. Over two decades, the agency has issued thousands of patents on genes.

The patent office appears to have opposed the position taken in the Justice Department’s brief. None of its lawyers were listed as authors.

Mr. Wegner, who is at the firm Foley & Lardner, said he had talked recently with David J. Kappos, the director of the patent office. He said Mr. Kappos “seemed chagrined that the Department of Justice was taking a viewpoint very different from the patent office.”

The patent office said it had no further comment.

In the lawsuit at issue, medical societies, researchers and patients have sued Myriad and the research foundation, which have patents on the two genes, BRCA1 and BRCA2. Myriad sells a test for more than $3,000 that detects mutations in the genes that confer a very high risk of breast or ovarian cancer.

In March, Judge Robert W. Sweet of the United States District Court in Manhattan ruled that the patents were invalid. Now, with the case before the appeals court, the Justice Department has essentially agreed with him.

“Clearly, this is a major development,” said Chris Hansen, a lawyer at the American Civil Liberties Union, which is representing the plaintiffs. “In effect, the United States government has joined the plaintiffs.”