WASHINGTON — When an outbreak of the Ebola virus touched the United States’ shores in mid-2014, Donald J. Trump was still a private citizen. But he had strong opinions about how America should act.

Mr. Trump, who has spoken openly about his phobia of germs, closely followed the epidemic, and offered angry commentary about what he said was the Obama administration’s dangerous response. He demanded draconian measures like canceling flights, forcing quarantines and even denying the return of American medical workers who had contracted the disease in Africa.

“Ebola patient will be brought to the U.S. in a few days — now I know for sure that our leaders are incompetent. KEEP THEM OUT OF HERE!” Mr. Trump tweeted on that July 31 after learning that one American medical worker would be evacuated to Atlanta from Liberia. “The U.S. cannot allow EBOLA infected people back,” Mr. Trump wrote the next day, adding: “People that go to far away places to help out are great — but must suffer the consequences!”

In nearly 50 tweets, as well as in appearances on Fox News and other networks, Mr. Trump supported flight bans and strict quarantines and branded President Barack Obama’s deployment of troops to West Africa to fight the disease as “morally unfair.”