By  Mr. Bynum is the mayor of Tulsa, Okla.

Many people thanked me for taking action to save lives. Others compared me to Hitler.

On Saturday, Tulsa, Okla., and Oklahoma City joined 43 of the nation’s 50 largest cities in America that had ordered residents to “shelter in place.”

The public response was swift and intense. Many people thanked me for taking action to save lives in our community. Others compared me to Hitler.

That is what it is like to be a mayor in red-state America during this crisis.

The tension between individual freedom and community safety is not unusual, but it is particularly acute as people across the country are being asked to face an invisible enemy for an indefinite period of time.

Not a day passes without one group of people pleading to “lock it all down,” while another reminds you of their right to assemble.

So how do you navigate that as you try to protect the people who elected you to keep them safe? By following logic and science — adapting daily and communicating with other mayors.

I gained an appreciation for this in the week after our first positive case came in on March 6. Throughout that week, we repeatedly heard that regulations to enforce social distancing need not be triggered until evidence of community spread had been identified. Our first and second cases were travel-related.

But as the week went by, I realized the fault in this logic: How could we find community spread if testing wasn’t available to detect it?

Mayors don’t have time for philosophizing. We have to get things done. Either the street gets fixed or it doesn’t. Either the police officers get hired or they don’t. But what if you didn’t know which streets to fix or how many officers you needed? How do you take on a virus in an epidemic if you don’t know where it is?

You assume the worst. I called our local health department director and talked with him about my concerns about the lack of testing. He told me he shared them and that he supported an event limit.

Eight days after being notified of our first case, I announced a ban on events of 250 or more in city facilities, based on the Centers for Disease Control and Prevention guidance to other states. We encouraged all groups to follow this guidance to slow the spread of the virus.

That night, the governor of our state posted a photo on social media of him and his family enjoying a night out in a crowded food hall and encouraged others to do the same.

While it created a national media firestorm, I understand why he did it. It’s frightening for elected leaders not to know when this crisis will end and how badly it will damage our economies.

Navigating that line between protecting people from a deadly virus and protecting them from poverty is one that elected leaders are grappling with at every level of government.

Two days after that food hall post, again based on the guidance of our local health department, I ordered the closure of all bars, entertainment venues and restaurants (except for takeout and delivery). We also reduced our event attendance maximum to 50 people, in line with revised C.D.C. guidance.

Aside from the death of family members, it was the worst day of my life. I was knowingly causing the unemployment of thousands in our city, and I was shutting down the dreams of so many entrepreneurs who have put their all into building a great restaurant scene in Tulsa.

But I knew it was necessary to save lives in Tulsa.

The pushback was immediate, but interestingly it was not from restaurant owners. Most of them with whom I spoke didn’t want their staff exposed to the virus by patrons, and they didn’t want to be the cause of people spreading the virus. They also wanted all restaurants to be treated the same way.

The pushback was from local activists, whose advocacy of personal freedom I generally share. But the arguments were weak.

On the one hand, you had the C.D.C. and the president of the United States issuing guidance that stated, “In states with evidence of community transmission, bars, restaurants, food courts, gyms, and other indoor and outdoor venues where groups of people congregate should be closed.”

And on the other hand, you had bumper sticker slogans and out-of-context quotes from the founding fathers. I’m sure Benjamin Franklin, one of the great proponents of scientific inquiry in his time, would not appreciate his thoughts on liberty being cited in defense of letting people thoughtlessly spread a virus.

Fortunately, the weakness of these arguments and the sound guidance of our local health department carried the day in suburb after suburb that passed orders similar to our own. In the Oklahoma City metro area, the same phenomenon occurred. Municipal governments led the way.

Our governor subsequently closed nonessential businesses in counties with a positive test case and issued a “safer at home” order for those most vulnerable to the virus.

Which brings us to our own shelter-in-place order. Depending on the model you use, we expect contagion to peak in Tulsa between mid-April and mid-May. Every statistical model I’ve seen shows an overwhelming of our local health care system if we do nothing to isolate individuals and slow the spread of the virus over time.

So on Saturday, I ordered shelter-in-place, restricting activity outside the home to those things necessary to survive: food, health and essential work.

I know there are people in Washington who have focused on who is to blame for this pandemic’s spread in the United States. It must be nice to have time for that. Meanwhile, we’re out here trying to prevent our neighbors from dying because they can’t get a ventilator.

To be honest, I don’t have a lot of time now to watch speeches from the nation’s capital. But I do have gratitude for a handful of important federal initiatives.

I am grateful for the president’s travel ban on countries with high rates of the virus. Our first cases were travel-related and we felt powerless that we couldn’t prevent people from bringing the virus into our community. President Trump halted that and allowed us to focus on managing the local spread.

It is a tremendous blessing to have world-class experts like the C.D.C. and Dr. Anthony Fauci, director of the National Institute of Allergy and Infectious Diseases, providing guidance we can rely upon when making decisions in a fog.

The availability of Small Business Administration loans are a lifeline, and the relief bill passed by Congress will help defer the full economic brunt of this event over time (even if my great-great-grandchildren will be paying off the debt).

But the greatest resource in all of this has been other local governments that are in the same spot. While Tulsa and Oklahoma City have historically had the kind of juvenile sibling rivalry you see in other neighboring cities around the country, Mayor David Holt and I have worked in tandem throughout this event so that both cities are under the same rules at the same time. Our two cities have never worked together more closely.

Each opportunity I have to work with fellow mayors is a reminder that while fighting the spread of the virus feels very personal and very local, each local response is very much part of a larger collective effort.

And while our own shelter-in-place order was met with the kinds of comments I mentioned at the opening of this column, on Sunday the streets of Tulsa were pretty quiet.

Most people are willing to sacrifice a bit of freedom and convenience to protect the lives of the people they love. And in the end, love of neighbor is more important at a local level than political party or ideology. This is what will get us through the current pandemic together.

G.T. Bynum is the mayor of Tulsa, Okla.

The Times is committed to publishing a diversity of letters to the editor. We’d like to hear what you think about this or any of our articles. Here are some tips. And here’s our email: letters@nytimes.com.

Follow The New York Times Opinion section on FacebookTwitter (@NYTopinion) and Instagram.