In an internal memo, Pentagon leadership has urged military personnel not to take mail-in DNA tests, warning that they create security risks, are unreliable and could negatively affect service members’ careers.

The letter, which was reported by Yahoo News, was sent on Friday. It does not name any particular DNA testing companies, but counsels broadly against buying ancestry and health tests promoted with military discounts and other military incentives.

Cmdr. Sean Robertson, a Pentagon spokesman, confirmed that the memo had been sent.

“We want to ensure all service members are aware of the risks of Direct to Consumer (DTC) genetic testing,” he told The New York Times over email.

Over the past decade, millions of Americans have purchased DNA tests through companies such as 23andMe and Ancestry with the hopes of connecting with relatives, finding out more about their family origins and learning about how their DNA could affect their chances of developing certain health conditions. In recent years, the tests have become popular holiday gifts.

Commander Robertson said that the tests might provide inaccurate results and have negative professional consequences. “The unintentional discovery of markers that may affect readiness could affect a service member’s career, and the information from DTC genetic testing may disclose this information,” he said.

Genetic tests have more serious employment implications for members of the military than the average office worker, said Frederick Bieber, an associate professor of pathology at Harvard Medical School, who served as an Army Reserve officer at the DNA Identification Lab in Rockville, Md.

The Genetic Information Nondiscrimination Act — known as GINA — prohibits discrimination by health insurers and employers based on the information that people carry in their genes. It does not apply to members of the military, however.

“The military can make decisions about operational readiness,” Dr. Bieber said, whereas “in the civilian world there are prohibitions about it.”

If a DNA test shows that someone has carrier status for sickle cell trait, for example, he said it could limit advancement in some aviation specialties.

The memo was written by Joseph D. Kernan, the under secretary of defense for intelligence, and James N. Stewart, the assistant secretary of defense for manpower. They warn that the tests “could expose personal and genetic information, and potentially create unintended security consequences and increased risk to the joint force and mission.”

The memo does not get into what specifically these risks might be, and Commander Robertson declined to elaborate.

In a statement, a spokeswoman from 23andMe said that the company took great care to protect customers’ privacy.

“Our FDA-authorized health reports have been tested to be over 99% accurate,” she said.All of our testing is done in the U.S., and we do not share information with third parties without separate, explicit consent from our customers.”

An Ancestry spokeswoman said that the company had not targeted military personnel with discounts. “Ancestry does not share customer DNA data with insurers, employers, or third-party marketers,” she added.

The Pentagon does not advise against genetic testing altogether. But service members were encouraged to get genetic information “from a licensed professional rather than a consumer product,” Commander Robertson said.