While the threat of the coronavirus may seem dire in San Francisco, there’s a long way to go to reach the widespread fear surrounding the 1918 Spanish influenza.

That fear turned out to be very well justified. Even with mandatory masks under penalty of arrest, mass quarantines and a ban on public dancing, the Spanish flu killed thousands of San Franciscans, many more than the 1906 earthquake and fires.

As the deadly virus spread quickly through the Midwest, the first San Francisco case was reported on Sept. 23, 1918, when Edward Wagner of Eddy Street reportedly brought the flu by train from Chicago. Within the next three weeks, there were more than 500 cases and nearly 50 deaths in the city.

By mid-October, the Presidio Army base was closed to outsiders because of virus fears, and city leaders announced wearing masks in public was mandatory, under penalty of a $100 fine and 10 days in jail. The San Francisco Department of Public Health told commuters to keep streetcar windows open. Dancing was discouraged, and later banned.

“You are urgently requested to refrain from dancing in public places, as this is one of the most active and harmful means of spreading infection,” a Department of Public Health report stated, “through the dust raised, close contact with people and intermingling of breaths.”

Citizens seeking refuge at church found diminishing solace. At the First Baptist Church on Octavia Street at Market Street, the theme of one early October service was “The Spanish Influenza, One of the Last Plagues.” The sermon was moved outside because of influenza fears.

By Sunday, Oct. 20, The Chronicle reported, most churches were closed.

“The Church Federation would remind the people that laws of health are as sacred as the Ten Commandments and should be diligently obeyed,” the San Francisco Church Federation wrote in a statement on The Chronicle religion page. “… We suggest this text for these days: ‘I will not fear, for thou art with me.’”

There were pleas not to panic in the early days, and suggestions that the new rules were precautionary. But by the end of October, one grim story after another filled the pages of the newspaper. In that month alone, more than 15,000 people got sick and 500 died.

And unlike the coronavirus, which causes the disease COVID-19, children seemed to be hit even harder than adults.

“Each child was tagged with his name, address and number,” The Chronicle reported, in a story about children being moved from San Francisco Hospital to the Children’s Hospital. “There were dark-eyed babies and fair babies, large and small. All were pale and wan, drawn by the fever they had defeated. All were silent. None were attended by mothers and fathers. Many had been made orphans since they had come to the big hospital.”

With hospitals filled, buildings, including the railroad car barn in the Presidio and Oakland Civic Auditorium, were filled with beds for quarantined Spanish flu patients. Police trucks were used as ambulances.

Red Cross volunteers used gauze to make masks by the thousands, and photos from the time show they were being used.

A photo from The Chronicle archive shows a crowd outside the paper’s Market Street newsroom on Armistice Day, Nov. 11, 1918, marking the end of World War I. As torches burn and flags wave in celebration, almost everyone on the street is wearing a mask.

Before the deaths started piling up, there were advertisements by drug companies for miracle cures. Owl Drug Store recommended “frequent use of throat gargles, mouth washes and nasal sprays,” selling Listerine for 23 cents as an influenza fighter. (It wasn’t.)

By the time the virus circulated again in early 1919, more than 6,000 Bay Area residents were dead. It was a small fraction of the 675,000 who died in the United States, and more than 50 million worldwide.

Thankfully, the coronavirus has a long way to go to reach 1918 levels of devastation. The first two cases in San Francisco were confirmed this week, with proactive steps, including school closures, already beginning. There are antibiotics and other tools to fight the virus and its secondary effects.

With science and luck, the coronavirus won’t come anywhere near the worst flu of the last century. The Spanish influenza should never be topped.

Peter Hartlaub is The San Francisco Chronicle pop culture critic. Email: phartlaub@sfchronicle.com Twitter: @PeterHartlaub