GENEVA — Six world powers and Iran reached a preliminary agreement early Sunday to curb Tehran's disputed nuclear program after a marathon negotiating session, potentially ending a decade of diplomatic stalemate.

After four days of talks that repeatedly appeared ready to collapse, officials announced that they had agreed on a six-month deal aimed at giving Iran limited sanctions relief in return for temporary curbs on its nuclear program.

The deal could ease the threat of war and reduce tension between the U.S. and Iran, but it could also prove difficult to implement, and the follow-up long-term agreement could be far more difficult to nail down, U.S. officials acknowledge.

"Iran, like any nation, should be able to access peaceful nuclear energy, but because of its record of violating its obligations, Iran must accept strict limitations on its nuclear program that make it impossible to develop a nuclear weapon," President Obama said in a late-night statement aired from the White House.

"The burden is on Iran to prove to the world that its nuclear program will be exclusively for peaceful purposes," Obama said.

Mohammad Javad Zarif, the Iranian foreign minister, said on his Twitter account at 3:03 a.m. Geneva time, "We have an agreement."

The deal, described by Obama as "an important first step toward a comprehensive solution," is intended to open the way for what is likely to be even tougher bargaining to reach a comprehensive agreement.

U.S. Secretary of State John F. Kerry, speaking in Geneva, said that limiting Iran's nuclear program would expand the time Tehran would need to reach a nuclear weapons capability.

"It will make our ally Israel safer," he said in a news conference.

But the deal was quickly denounced by leading Republicans in Washington.

"Amazing what WH will do to distract attention from O-care," Sen. John Cornyn of Texas said in a Twitter statement.

Obama administration officials have said an agreement would ease what has been long viewed as one of the world's most urgent security challenges. Iran is believed by some experts to be close to acquiring bomb-making capability, and the administration has threatened to use force, if necessary, to prevent it from acquiring a nuclear weapon.

Even though the six countries and the new government in Iran were eager for a deal, they had clashed over a series of issues related to how closely supervised Iran's huge nuclear program would be and how much relief it would get from the penalties that have been crushing its economy.

A senior U.S. official said the agreement would halt progress at nuclear facilities at Fordow and Natanz and the partially built heavy-water reactor at Arak. It also calls for more intrusive inspections of Iran's nuclear facilities and for the "neutralization" of its medium-enriched uranium, which is considered a threat because it can be readily converted to bomb fuel.

Iranian news agencies said the deal recognized Iran's "right to enrich" uranium, but U.S. officials denied that.

Zarif acknowledged after the announcement that the right demanded by Iran was not spelled out in the text of the agreement. But in a news conference, he said it did not need to be specified because it was Iranians' inalienable right.

Under the deal, Iran will be allowed to continue producing low-enriched uranium, suitable for energy generation, and it won't be required to send its nuclear material out of the country, as Western governments previously demanded, said the official Fars News Agency.

As part of the deal, Iran agreed not to install any additional centrifuges, and not to begin operating any of the thousands that are not yet operational. But the deal doesn't require Iran to dismantle any of its centrifuges, a demand made by Israel.

The agreement will allow Iran to accumulate more low-enriched uranium, to eight tons from the current seven. But it also provides that by the end of the six-month period it must turn that extra material into an oxide form that makes it at least temporarily unusable as bomb fuel.

Sanctions on the use of gold and other precious metals in trading will be lifted, as will sanctions on insurance and the transportation industry.