PORTSMOUTH, Va. (WAVY) — A Portsmouth Judge ruled Thursday that the city jail cannot be condemned and that the city must complete repairs at the facility.

The ruling comes after a monthslong legal battle. In July, the city’s building and code official decided to condemn the city jail and the rest of the civic center after reportedly finding problems with the fire suppression system and unsanitary conditions, among other issues.

Sheriff Michael Moore filed a lawsuit against the city fighting the condemnation, saying he was given no notice.

Then, just last month, the City of Portsmouth filed its own separate petition asking a judge to order the sheriff to move current inmates and any new prisoners to the Hampton Roads Regional Jail, which has room to spare.

At the conclusion of previous hearings, Judge Johnny Morrison urged both sides to try to work things out outside of court.

After all the testimony wrapped up Thursday, the judge heard something about the city manager that prompted him to ask more questions.

The judge asked the sheriff to take the stand.

Moore testified he tried to work things out outside of court. He said at a September meeting with City Manage Dr. Lydia Pettis-Patton, Pettis-Patton said only two words — just ‘Hello’ and ‘Goodbye.’ Moore testified City Attorney Solomon Ashby did all of the talking.

“That’s not operating in good faith,” Morrison said. “Maybe she was allowing the city attorney to speak for her. But nobody is here to convey that to the court. But she is the city manager… It wasn’t the city attorney who condemned these buildings.”

Morrison said in court Pettis-Patton is the one who condemned the buildings in the first place without giving any notice to the sheriff, police chief or magistrate — and that it appeared she had her mind made up.

Attorney Jon Banineau, who represents the sheriff, says repairing the current jail is the most sensible, money-saving option for Portsmouth citizens.

He estimates repairs to cost around $300,000, far less than what it would cost to send inmates to the Hampton Roads Regional Jail.

Yet Judge Morrison could still rule otherwise. He gave the city and sheriff 60 days to continue to negotiate where to send inmates.

The city has an agreement to house a minimum of 250 inmates at HRRJ, but right now has fewer than 50. Moore decided late last year he would no longer send inmates there until the regional jail addressed problems cited by the Department of Justice.

Portsmouth pays $16,250 a day — or close to $6 million a year — to be a part of the authority and reserve 250 beds at the regional jail. As of Thursday, they have 38 inmates there. There are 280 in the city jail.

Several members of City Council want the sheriff to use all 250 beds.

WAVY reached out to the city manager for comment, but city officials said they had no comment on the jail matter.

Mayor John Rowe did not respond to multiple requests for comment.

“I believe the judge made the right decision and now the city must do our part to make the repairs and work with the sheriff on a transition plan. Some members of Council feel that the decision was political, but I feel that it was a fair deal, considering the problems at the HRRJ,” Vice Mayor Lisa Lucas-Burke said.

However, Councilman Nathan Clark is concerned about the money it will all cost to build a new jail.

“I am not the enemy,” Clark said. “But we can’t afford a new jail.”