US regulators Friday approved the first treatment for smallpox — a deadly disease that was wiped out four decades ago — in case the virus is used in a terror attack.

Smallpox, which is highly contagious, was eradicated worldwide by 1980 after a huge vaccination campaign.

But people born since then haven’t been vaccinated, and small samples of the smallpox virus were saved for research purposes, leaving the possibility it could be used as a biological weapon.

Maker SIGA Technologies of New York has already delivered 2 million treatments that will be stockpiled by the government, which partially paid for the development of the drug, called TPOXX.

To test the drug’s effectiveness, monkeys and rabbits were infected with a similar virus and then given the drug. More than 90 percent survived, the company said. Its safety was tested in several hundred healthy volunteers, who were not infected with smallpox.

Smallpox killed about 300 million people worldwide in the 20th century before its eradication. Symptoms include fever, fatigue and pus-filled sores. Until now, doctors could only provide supportive care such as IV fluids and fever remedies and isolate the patients. Vaccination can be used to prevent infection but it must be done within five days of exposure to the virus, well before symptoms appear.

“This new treatment affords us an additional option should smallpox ever be used as a bioweapon,” Dr. Scott Gottlieb, head of the Food and Drug Administration, said in a statement.

The drug is a capsule, taken twice daily for 14 days.

SIGA develops vaccines and medicines for biological, chemical, radiological and nuclear attacks. Chief Executive Phil Gomez said the company is developing an IV version and is exploring selling the drug to other countries and developing it to treat other infectious diseases, including monkeypox, which African monkeys can transmit to humans. Monkeypox can then spread among people, and has a mortality rate of about 15 percent.