A state appeals court has upheld a ruling in a legal battle between Pembroke Pines and a prison-building company — finding the city had an obligation to provide water and sewer service to a planned detention center.

Pembroke Pines has indicated it could possibly take the case all the way to the State Supreme Court.

The city has argued for years that it was not obligated to provide water and sewage to a 24-acre site west of Southwest 196th Avenue in Southwest Ranches, between Sheridan Street and Stirling Road.

The Fourth District Court of Appeals’ ruling on Wednesday upheld a ruling from six months ago. The court found that Pembroke Pines had “expressed its intention to assume such a duty” in extending its water and sewage lines to serve the facility.