The recent fight over food inspections between two Minnesota state agencies and the city of St. Paul is exactly the kind of intergovernmental conflict we hate to see. It’s always preferable for cities, counties and the state to cooperate rather than to use precious time and resources taking each other to court.

But now that a judge has denied St. Paul’s appeal to keep the function, the state can proceed with plans to take over food inspections in the city. That transition should take place as efficiently as possible. Proper oversight of food, lodging and pools is essential to protect public safety.

This food fight came to a head when both the state Departments of Health (MDH) and Agriculture (MDA) reported multiple, ongoing problems with St. Paul food safety operations. State evaluations reported serious errors in reports, inadequate inspection frequency and continued failure to meet state standards.

MDH delivered those findings in June 2012. But St. Paul officials wanted to maintain the city’s inspection authority. The city has handled the function for more than 100 years and now licenses and regulates more than 2,100 retail food establishments. So the state worked with the city to develop a conditional agreement and give it more time to comply.

Under Minnesota law, the state departments have jurisdiction over inspections but can cede that authority to local units of government through delegation agreements — provided that the locals meet state requirements.

As of Monday, both state agencies terminated their delegation agreements with the city to inspect restaurants, lodging facilities and swimming pools, arguing that St. Paul had failed to improve enough.

City officials countered that they were in the process of complying, had hired six new inspectors and had added $725,000 to the inspections budget. They also had conducted more than 1,900 hours of training and had reduced the average overdue days on their backlog of cases by more than 45 percent. They believed the state agencies acted in bad faith by not giving them more time to see the results of their investments.

They added that St. Paul’s incidents of food-borne illnesses and other safety problems are not out of line with those in similar communities. The state takeover, they say, will result in the loss of 15 city positions — including the five new hires they made to comply with state rules. As a result, St. Paul leaders asked the court for a temporary restraining order to prevent the state agencies from taking over inspections.

However, on Friday, Ramsey County District Judge Elena Ostby denied the city’s request. She ruled that the state agencies “have clearly articulated reasons for declining to continue to delegate the inspection responsibilities” and wrote that the court could not find that the city would suffer “immediate and irreparable harm, such as risk to public safety,” by the state takeover.

While St. Paul officials provided a long list of changes made since last year’s MDH report, state officials said a more recent evaluation proved the changes inadequate. A July 1 letter from the state to the city says that St. Paul failed a June 2013 evaluation and lacks “internal controls to ensure the public’s health is being protected.”

An evaluation of 114 city inspection reports from May to June this year cited “serious” errors in 70 percent of them, and a sample of swimming pools showed 74 percent of them were overdue for inspection.

Yet in a statement following Friday’s court decision, Mayor Chris Coleman said, “As before, I am confident that the City of St. Paul is best suited to conduct inspections. … I plan to explore all options that return this important line of business back to the city …”

But with no-confidence votes from two state agencies and with court agreement, the city should not continue the fight. Now it is essential that state and city inspectors make the transition as smoothly and efficiently as possible. Protecting the public safety is the primary goal — no matter which level of government has the responsibility.