A workman clears snow from the plaza at the U.S. Supreme Court in Washington in Washington, Monday, March 3, 2014, as visitors line up to hear arguments. (J. Scott Applewhite, Associated Press)

WASHINGTON — The Supreme Court on Monday sided with a Wyoming property owner in a dispute over a bicycle trail that follows the route of an abandoned railroad, a decision that could force the government to pay hundreds of millions of dollars to compensate landowners.

The justices ruled 8-1 that property owner Marvin Brandt remains the owner of a 200-foot-wide trail that crosses his 83-acre parcel in southern Wyoming's Medicine Bow National Forest. The trail once was the path of a railroad and is among thousands of miles of abandoned railroads that have been converted to recreational trails.

Chief Justice John Roberts said the government was wrong to assert that it owns the trail.

Justice Sonia Sotomayor said in dissent the court's decision "undermines the legality of thousands of miles of former rights of way that the public now enjoys as means of transportation and recreation."

The dispute has its roots in the settlement and development of the western United States in the 1800s. The government gave railroads the right to lay track on public lands to make it easier for people to get to and live in the West. Later, the government gave away millions of acres of public land to settlers and homesteaders, but preserved the railroads' path through these once-public lands.

As Roberts noted Monday, "The settlers and their successors remained, but many of the railroads did not."

Brandt's case involved what happens to the railroad's path, known as a right of way, when the railroad abandons it, under a law dating from 1875.

Roberts, writing for the court, said that the owners of the Laramie, Hahn's Peak and Pacific Railroad — the LHP&P — had "rosy expectations" when they completed a 66-mile run from Laramie, Wyo., to Coalmont, Colo., in 1911.

The owners said it would become "one of the most important railroad systems in this country," Roberts said. He also noted that locals at the time said that the acronym LHP&P stood for "Lord Help Push and Pull" or "Late, Hard Pressed and Panicky." In any event, the railroad didn't make any money.

The line changed hands a couple of times before its last owners tore up the tracks and abandoned it in 2004. The government claimed it two years later and all but one of 31 land owners along the route gave up any claims.