NEW YORK - Investors are closely watching events in Israel as a geopolitical risk to markets, with some expectation the violence could prompt a move into safe haven assets.

Gunmen from the Palestinian group Hamas entered Israel in an unprecedented attack on Saturday. Western countries, led by the United States, denounced the attack and pledged support for Israel.

Rising geopolitical risk could see buying in assets like gold and the dollar and potentially boost demand for U.S. Treasuries, which have been sold off aggressively, analysts said.

"This is a good example of why people need gold in their portfolios. It is a perfect hedge against international turmoil," said Peter Cardillo, chief market economist at Spartan Capital Securities, who predicted the dollar would also benefit.

"Anytime there is international turmoil, the dollar strengthens," said Cardillo.

Markets have been reacting in recent weeks to an expectation that U.S. interest rates will stay higher for longer. Bond yields have soared while the U.S. dollar has been on a streak of gains. Stocks meanwhile had sharp losses for the third quarter but stabilized in the last week.

"Whether this is a massive market moment or not depends on how long it lasts and whether others are sucked into the conflict," said Brian Jacobsen, chief economist at Annex Wealth Management, of the situation in Israel. Jacobsen questioned how much impact it would have on the oil price despite Iran having been boosting output.

The Hamas attack was openly praised by Iran and by Hezbollah, Iran's Lebanese allies.

"Iranian oil production has been increasing, but any progress they’ve been making behind the scenes with the U.S. will be dramatically undermined by Iran’s celebrating Hamas’s actions," said Jacobsen, adding that "the possible output loss matters, but it won’t be earth shattering."

"It’s most critical to see how Saudi Arabia reacts," said Jacobsen. Washington has been trying to strike a deal that would normalise ties between Israel and Saudi Arabia.

David Kotok, chair and chief investment officer at Cumberland Advisors in Sarasota, Florida, said that the situation was concerning as the U.S. is weakened by dysfunction in Washington. Republicans are looking for a successor to ousted Speaker Kevin McCarthy of the House of Representatives, and a budget showdown looms.

"I am very worried about more explosive situations that require U.S. determination and U.S. defense capability which is being injured," by the situation in Washington, Kotok said.

(Reporting by Megan Davies; Editing by Lisa Shumaker)