* Harvey knocked out almost a quarter of U.S. refining capacity
* U.S. oil production also hit, albeit to lesser degree
* But there are signs of lower-than-feared infrastructure damage
* Markets nervously eye North Korea after nuclear test (Adds comment, link to factbox; updates prices)
SINGAPORE, Sept 4 (Reuters) - Oil markets were volatile on Monday, supported by shutdowns of U.S. production following Hurricane Harvey, but pressured by an expected downturn in crude demand as the storm knocked out refineries along the Gulf of Mexico coast.
Harvey, which made landfall along the Gulf coast of Texas and Louisiana last week, knocked out almost a quarter of the entire U.S. refining capacity, causing a price spike and supply gap for fuels like gasoline, which traders around the world have been scrambling to fill.
It also hit some U.S. oil production, yet has at the same time cut demand for crude from the crippled petroleum industry, resulting in a mixed and volatile market reaction.
U.S. West Texas Intermediate (WTI) crude futures were at $47.42 barrel at 0227 GMT, 13 cents above their last settlement.
However, international Brent crude oil futures were at $52.48 per barrel, down 27 cents, or 0.5 percent from their last close.
Markets were nervously eyeing developments in North Korea, where the military conducted its sixth and most powerful nuclear test over the weekend, which the government said was of an advanced hydrogen bomb for a long-range missile, prompting the threat of a "massive" military response from the United States if it or its allies were threatened.
Some downward pressure in crude came from traders cutting back bullish wagers. Trade data on Friday showed that financial traders had cut their combined long futures and options position in New York and London by 105,377 contracts to 165,896 in the week to Aug. 29, the lowest level since late June.
Traders said the cutbacks were the result of expectations of lower crude demand due to the U.S. refinery closures.
However, about 5.5 percent of the U.S. Gulf of Mexico's oil production, or 96,000 barrels of daily output, remained shut on Sunday, the federal Bureau of Safety and Environmental Enforcement said.
Some U.S. Gulf refineries and fuel pipelines were gradually restarting operations over the weekend, triggering hopes that the flood damage to the energy infrastructure is less severe than initially feared.
"It appears that damage to refining capacity is minimal ... (and) traders are hopeful that crude backlogs will be cleared," said Jeffrey Halley, senior market analyst at futures brokerage OANDA.
Still, many analysts say it could take months before the U.S. petroleum industry fully recovers from Harvey, and Texas Governor Greg Abbott estimated damage at $150 billion to $180 billion, calling it more costly than Hurricanes Katrina or Sandy, which devastated New Orleans in 2005 and New York in 2012.
(Reporting by Henning Gloystein; Editing by Joseph Radford)