In a potentially costly setback to the federal government’s rails-to-trails program, the U.S. Supreme Court on Monday ruled that under an 1875 law, abandoned railroad rights of way belong, not to the government, but to the private parties that acquired the underlying lands.

Offering a short history of the settlement and development of the West and the role of railroads in that history, Chief Justice John Roberts Jr. said that rights of way over public lands granted under the 1875 General Railroad Right-of-Way Act were easements that ended with a railroad’s abandonment.