By Louis Charbonneau and Stephanie Nebehay

LAUSANNE, Switzerland (Reuters) - Iran and world powers reached a framework agreement on Thursday on curbing Iran's nuclear programme for at least a decade, a step towards a comprehensive accord that could end 12 years of brinkmanship, threats and confrontation.

The tentative agreement, after eight days of marathon talks in Switzerland, clears the way for talks on the future settlement that should allay Western fears that Iran was seeking to build an atomic bomb and in return lift economic sanctions on the Islamic Republic.

The framework is contingent on reaching an agreement by June 30 and all sanctions on Iran remain in place until a final deal is reached.

Many details still need to be worked out and diplomats close to the negotiations said the deal was fragile. It could not be ruled out that the understandings reached could collapse between now and June 30. Experts believe it will be much harder to reach a final deal that it was to agree the framework accord.

U.S. President Barack Obama said the outcome was a good deal, comparing it to nuclear arms control deals struck by his predecessors with the Soviet Union that "made our world safer" during the Cold War.

"Today, the United States, together with our allies and partners, has reached an historic understanding with Iran, which if fully implemented, will prevent it from obtaining a nuclear weapon," he declared.

Under the outline deal, Iran would shut down more than two-thirds of its installed centrifuges capable of producing uranium that could be used to build a bomb, dismantle a reactor that could produce plutonium, and accept intrusive verification.

The negotiations went right down to the wire, with no certainty that they would not end in failure.

"The political determination, the good will of all parties made it possible," EU foreign policy chief Federica Mogherini told a news conference.

"This is a crucial decision laying the agreed basis for the final text of joint comprehensive plan of action. We can now start drafting the text and annexes," said Mogherini, who has acted as a coordinator for the six powers - Britain, China, France, Germany, Russia and the United States.

IRANIAN CAUTION

The framework, fiercely opposed by U.S. ally Israel, includes limits on Iran's enrichment of uranium for 10 years.

Iran's Foreign Minister Mohamad Javad Zarif cautioned however: "We're still some time away from reaching where we want to be."

Iran agreed to significantly reduce the number of installed uranium enrichment centrifuges it has to 6,104 from 19,000 and will only operate 5,060 for 10 years under the future agreement with the six powers, according to a U.S. fact sheet. Iran will only use first generation centrifuge during that time, it said.

One of the most sensitive issues during the negotiations, Iran's research and development work, will also be limited.

"Iran has agreed to not conduct research and development associated with uranium enrichment at Fordow for 15 years," the U.S. fact sheet said. It also noted that Iran will remove the 1,000 more advanced second-generation centrifuges currently installed at Natanz and place them in International Atomic Energy Agency-monitored storage for ten years.

High enriched uranium can be used to make a weapon, which they aim to prevent, while low enriched uranium is used in power plants. Iran has always insisted it wants it only for a peaceful nuclear energy programme and denies it aimed to build an atomic bomb.

Iran's breakout timeline – the time that it would take for it acquire enough fissile material for one weapon - would be extended to at least one year, for a duration of at least ten years, under this framework. It is currently assessed to be two to three months, the U.S. fact sheet said.

Iran will gradually receive relief from U.S. and European Union nuclear sanctions as it demonstrates compliance with the future comprehensive agreement, which Iran and the powers aim to conclude by June 30. Some U.N. Security Council sanctions would be gradually lifted, though others would remain in place, specifically those relating to proliferation.

Failure to comply with terms of the deal will cause the U.S. and EU sanctions to "snap back into place", the U.S. fact sheet said. It was less specific on U.N. sanctions, one of the main sticking points in the negotiations, saying only that could be reimposed in the event of Iranian non-compliance.

Story continues