By Louis Charbonneau and Justyna Pawlak

VIENNA (Reuters) - Six world powers and Iran launched a decisive phase of diplomacy on Wednesday to draft a lasting accord that would curb Tehran's contested nuclear activity in exchange for a phased end to sanctions that have hobbled the Iranian economy.

After three months of discussing expectations rather than negotiating possible compromises, the sides are to set about devising a package meant to end years of antagonism and curtail the risk of a wider Middle East war with global repercussions.

A Western official close to the talks said on Wednesday that "progress is being made but all pieces have to fit together".

"Nothing is agreed yet," the official told Reuters on condition of anonymity.

Washington's decades-long estrangement from Iran could ease, improving international stability, if a deal were done but U.S. and other Western officials warned against unwarranted optimism given persisting, critical differences between the sides.

"We've spent the last couple of rounds putting all of the issues on the table, seeing where there may be points of agreement, where there may be gaps. There are some very significant gaps," a senior U.S. official said on Tuesday.

"It's not that there aren't solutions to those gaps; there are. But getting to them is another matter."

To get a deal, the United States, Russia, China, France, Britain and Germany will want Iran to agree to dramatically cut back its uranium enrichment program to remove any risk that it could lead to the making of atomic bombs, while Iran will want them to eliminate sanctions against its oil-based economy.

Diplomats from both sides have said they want to resolve all sticking points about issues such as Iran's capacity to enrich uranium and the future of its nuclear facilities, as well as the timeline of sanctions relief, by a July 20 deadline.

After that, an interim deal they struck last November expires and its extension would probably complicate talks.

Story continues

A spokesman for EU foreign policy chief Catherine Ashton, who coordinates diplomacy with Iran on behalf of the six, said negotiators held a "useful initial discussion" on Wednesday morning and would hold coordination meetings later in the day.

"We are now hoping to move to a new phase ... in which we will start pulling together what the outline of an agreement could be. All sides are highly committed," Michael Mann said.

ISRAELI THREAT TO HIT IRAN

Looming in the background of the talks have been threats by Israel, widely believed to have the Middle East's only nuclear weaponry but which sees Iran as a existential threat, to attack Iranian nuclear installations if it deems diplomacy ultimately futile in containing Tehran's atomic abilities and potential.

U.S. President Barack Obama has not ruled the last-ditch option of military action either.

Broadly, the six powers want to ensure the Iranian program is curtailed enough so that it would take Iran a long time to assemble nuclear bomb components if it chose to do so, and would be detected with intrusive inspections before it was too late.

Iran denies accusations of having nuclear weapons aspirations, saying it wants only peaceful atomic energy.

Central to this issue will be the number of centrifuge machines, which potentially can enrich uranium to bomb-fuel quality, that Iran would be permitted to operate.

Tehran has about 10,000 centrifuges running but the West will likely want that number trimmed to the low thousands, a demand that could be unacceptable to the Islamic Republic.

Iran's research and development of new nuclear technologies and the amount of stockpiled enriched uranium it may keep will also be crucial and likely difficult to negotiate. Refined uranium can be used as fuel in nuclear power plants or in weapons if purified to a high enough level.

"Halting research and development of uranium enrichment has never been up for negotiation, and we would not have accepted it either," Iranian Deputy Foreign Minister Abbas Araqchi was quoted as saying by the ISNA news agency.

"But a wide variety of issues have been discussed ... and on uranium enrichment too we have tried to reach consensus."

Diplomats say Iran, rather than deactivating centrifuges, wants to expand its enrichment program, saying it needs to do this to fuel a planned network of nuclear power plants.

Iran entered talks with the big powers after moderate President Hassan Rouhani was elected last June.

"OUT OF CONTROL"

Diplomats have signaled some progress may have been made during three rounds of expert-level talks since February on one of the thorniest issues - the future of Iran's planned Arak heavy-water reactor, which Western states worry could prove a source of plutonium for nuclear bomb fuel once operational.

But the U.S. official cautioned that some media reports about progress reached up until now were going too far.

"I've read a lot of the optimism you've written," the official told reporters. "It's gotten way out of control."

Other diplomats from the powers warned that progress, if any, in the coming talks will be slow. And any agreement may come only at the 11th hour. "It's very difficult to say how it will all work in practice now. We have no agenda but that's not different from any other meeting," said one.

"The figures will come at the end. They will be part of the big bargaining," he said, referring to decisions about issues such as the number of centrifuges to remain in Iran.

Much of the complexity of the final deal stems from the fact that its various elements are intertwined. A higher number of centrifuges left in Iran would mean the powers wanting Tehran to more substantially slacken the pace of enrichment, for example.

"All the parameters are interdependent," one diplomat said.

Politically, any deal could still be torpedoed by conservative hawks in the United States or Iran, and another interfering factor could be the approaching U.S. midterm congressional elections.

Divisions in Washington are closely linked to concerns in Israel that any deal might not go far enough. "We are not against diplomatic solutions. But on the one condition, that it is a serious and comprehensive solution. A solution that can be trusted," Yuval Steinitz, Israel's minister in charge of nuclear affairs, told reporters in Brussels last week.

"Iran should be denied not just to produce the bomb but also to have the capability," he said.

(Additional reporting by Fredrik Dahl and Parisa Hafezi in Vienna; Editing by Mark Heinrich)