Gold prices drifted lower on Thursday, pressured by a firmer dollar as investors awaited cues on further interest rate hikes from central bankers meeting in Jackson Hole this week.
Losses were limited, however, after a threat by U.S. President Donald Trump to shut down the government unless he got funding for a border wall with Mexico. Geopolitical risk tends to drive buying of safe-haven investments like bullion.
Key to the direction of the market were funds holding huge long positions in Comex gold futures, said Ole Hansen, head of commodity strategy at Saxo Bank in Copenhagen.
"We've had two failed attempts at the upside this year which resulted in a flush out of longs, and the longer we stay here without breaking higher, the bigger the risk that these guys will start to get impatient," he said.
Gold failed in April and June to break through the top of its broad $1,200-$1,300 range this year. "But at the same time, there's this threat to close down the U.S. government by Trump if he doesn't get his wall so that's providing some underlying support."
Spot gold was down 0.25 percent at $1,286.5 per ounce, giving back some of the previous session's gains.
The most-active U.S. gold futures for December delivery settled down $2.70 at $1,292 an ounce.