St. Paul took its inspections battle against the state of Minnesota to court on Monday, asking a Ramsey County District judge to block the state's takeover and give the city more time to meet statewide food and restaurant inspection standards.

But not long after the hearing for a temporary restraining order ended, the state Department of Agriculture said five state inspectors already were at work checking out St. Paul grocery and convenience stores.

The state Health Department, St. Paul's other opponent in the food fight, didn't deploy inspectors in the city on Monday. However, officials said they had chosen 47 Health staffers to be ready to license and inspect St. Paul businesses.

By the end of business on Monday, Ramsey District Judge Elena Ostby had not yet issued her ruling on the city's requested restraining order.

At issue was last week's decision by the Health and Agriculture departments to strip the city of its inspections authority — delegated by the state, which is ultimately responsible for public health — to review safety practices at food retailers, restaurants and other businesses.

The reasons, according to the state: shoddy record keeping, general incompetence and an ongoing failure to meet state standards.

It was a decision that had been building since at least last fall, when the Health Department and St. Paul reached a two-year conditional agreement to allow the city to continue inspections as long as it submitted its reports for state review. The city budgeted an additional $725,000 last year for new supervisors, more inspectors and training hours, and a reduced backlog of cases.

But according to the state, the city only last month handed over inspection reports — and then only reports from May and June that highlighted St. Paul's deficiencies in recording code violations, putting in compliance deadlines and initiating enforcement.

At the same time, the Agriculture Department, which reviewed St. Paul's inspections program last winter for the first time in 12 years and found it wanting, also yanked the authority it delegated to the city. Agriculture is responsible for inspecting groceries, delis and convenience stores.

St. Paul licenses and regulates more than 2,100 retail food establishments, including restaurants, grocery stores and delis.

In the courtroom Monday, Assistant City Attorney Daphne Lundstrom took the state to task for making "unilateral" decisions based on internal staff discussions, and suggested the state's termination of its inspections agreements with St. Paul represented a breach of contract.

"The city has never claimed it ran a perfect program. … It knew it needed improvements, and it did so," she said.

Lundstrom questioned the need to have the state replace city inspectors — the most recent data on the state website, from 2005, show St. Paul in the middle of local jurisdictions in terms of food complaints.

Jackson Evans, a Minnesota assistant attorney general, argued that administrative decisions should be reviewed by the state Court of Appeals.

On the substance of the case, Evans said that when "a city is failing in its public health program," the state, as the ultimate protector of the public's safety, has no alternative but to take over a city's inspections.

He displayed large photos showing rat feces and mouse urine found last winter in an unnamed St. Paul establishment. Lundstrom later said the photos represented a situation that was promptly reported and cleaned up.

"These are the types of violations that have to be corrected immediately," Evans said, adding that "numerous types of issues" were found in the state's review.