David J. Sencer, an influential director of the Centers for Disease Control and Prevention who promoted worldwide efforts to eradicate smallpox and measles but who was dismissed over a controversial 1976 decision to inoculate the nation against swine flu, died May 2 of heart disease at his home in Atlanta. He was 86.

Dr. Sencer, who was drawn to public health after suffering from tuberculosis as a young man, became director of the CDC in 1966 and promptly expanded the role of the Atlanta-based federal agency.

He made the CDC a worldwide disease-fighting organization, and under his leadership, the CDC played a major part in eradicating the once-dreaded disease of smallpox in the 1970s. Dr. Sencer also spearheaded the first national health and nutrition surveys in the United States and sought, without success, to eliminate measles and malaria.

“He is regarded as a singular force in public health,” Alfred Sommer, a professor at Johns Hopkins University and a former dean of its School of Public Health, said Wednesday in a telephone interview.

In 1976, CDC epidemiologists under Dr. Sencer began stalking an unknown killer when 29 people died after attending an American Legion convention in Philadelphia. In less than six months, the scientists isolated a then-unknown bacterium that caused what became known as Legionnaires’ disease, putting to rest theories that the veterans died from sabotage, poisoning or germ warfare.

A defining moment in Dr. Sencer’s career came when he decided to vaccinate the country against swine flu. In January 1976, a soldier at Fort Dix, N.J., died from a form of swine flu, and several other soldiers fell sick with the same illness.

It was similar to a strain of flu that caused a devastating influenza pandemic in 1918 and 1919, killing more than 500,000 Americans and more than 20 million people around the world. Federal officials feared in 1976 that as many as 1 million people might die in the United States from a swine-flu outbreak.

In the largest immunization project ever launched in this country, Dr. Sencer asked pharmaceutical companies to produce 200 million doses of vaccine. President Gerald R. Ford got a flu shot in the White House and asked Congress for $135 million “to inoculate every man, woman and child in the United States.”

Less than two weeks after the immunization began on Oct. 1, 1976, 25 people had died after receiving the vaccine. Scores of others were affected by a mysterious form of progressive paralysis called Guillain-Barre syndrome. Many became temporarily paralyzed, and several died.

Dr. Sencer maintained there was no link between the vaccine and the deaths, but other experts were skeptical and said the vaccine had not been properly tested.

The swine-flu program was suspended in December 1976 despite Dr. Sencer’s protests. In the end, more than 40 million people had been inoculated against an epidemic that never occurred.

Joseph A. Califano, secretary of the old Department of Health, Education and Welfare, asked for Dr. Sencer’s resignation in February 1977.

Two years later, Dr. Sencer appeared on CBS-TV’s “60 Minutes” as the subject of one of Mike Wallace’s more thorough grillings. Wallace got Dr. Sencer to admit that, except for the Fort Dix soldiers, no cases of swine flu had been confirmed anywhere in the world and that he wasn’t sure if the vaccine had been field-tested.

A subsequent federal study of the swine-flu controversy described Dr. Sencer as a “wily autocrat” who “moved too quickly” to immunize the nation.

Dr. Sencer always defended his decision to vaccinate.

“If there had been swine flu, we would have had deaths in the thousands,” he told The Washington Post in 2009. “Given the state of knowledge of influenza at the time, I think we made the right decision.”

David Judson Sencer was born in Grand Rapids, Mich., on Nov. 10, 1924. He attended Wesleyan University in Middletown, Conn., before serving in the Navy during World War II.

While attending medical school at the University of Michigan in 1947, he contracted tuberculosis and spent almost two years in a hospital. That “gave me time to think about my future,” he said in 1976.

Not long after graduating from medical school in 1951, he began working for the Public Health Service. He received a master’s degree in public health from Harvard University in 1958, then moved to Atlanta in 1960 to join the CDC, then still known by its original name, the Communicable Disease Center.

After his forced resignation in 1977, Dr. Sencer worked for a medical technology firm before becoming New York City’s health commissioner in 1982.

Gay rights groups criticized him for responding too slowly to the AIDS crisis of the 1980s, but Dr. Sencer eventually started one of the country’s largest AIDS treatment programs. He also argued in court to keep HIV-infected children in public schools and proposed distributing clean needles to drug addicts to prevent the spread of the disease.

He retired in 1989 and settled in Atlanta. Survivors include his wife, Jane Blood Sencer, whom he married in 1951; three children; and six grandchildren.

In his later years, Dr. Sencer became an unofficial CDC historian and often consulted with his former agency on outbreaks of disease around the world.

“I would say he’s certainly up there among the most effective CDC directors ever,” said Sommer, the Johns Hopkins professor and onetime CDC researcher. “There are few if any who outshone David.”