By George Jahn and Matthew Lee, AP

LAUSANNE, Switzerland — After marathon negotiations, the United States, Iran and five other world powers announced an agreement Thursday outlining limits on Iran's nuclear program to block it from developing atomic weapons and directing negotiators toward a final accord this summer.

The United States and Iran each hailed the framework, reached by weary but upbeat diplomats after a week of intense diplomacy in Switzerland that capped 18 months of negotiations. Speaking from the White House, President Barack Obama called it a "good deal" that would address concerns about Iran's nuclear ambitions.

Crucially for the Iranians, it also would provide them broad relief over time from international sanctions that have crippled their economy.

{Related: Iran and world powers agree on parameters of Iranian nuclear deal to be reached by June 30}

Still, critics in both nations as well as wary U.S. allies Israel and Saudi Arabia were likely to oppose the "plan of action" because of concessions allowing Iran to maintain significant elements of a program that could be used to produce either energy or nuclear arms.

"I am convinced that if this framework leads to a final comprehensive deal, it will make our country, our allies and our world safer," Obama declared. "It is a good deal, a deal that meets our core objectives."

In the Swiss city of Lausanne, European Union foreign policy chief Federica Mogherini and Iranian Foreign Minister Mohammad Javad Zarif read out a joint statement hailing what they called a "decisive step" after more than a decade of work. U.S. Secretary of State John Kerry and the top diplomats of Britain, France and Germany took the stage behind them.

Kerry defended America's compromises. "Simply demanding that Iran capitulate makes a nice sound bite, but it is not a policy, it is not a realistic plan," he said. Still, he said that "many technical details" must be ironed out.

Negotiators from the nations involved — including Russia and China — will now start writing the text of a final accord. Mogherini cited several agreed-upon restrictions on Iran's enrichment of uranium, a core concern because the material can be used in a nuclear warhead. She said a planned heavy water reactor in Iran wouldn't produce weapons-grade plutonium and work at a deeply buried underground facility at Fordo wouldn't involve uranium.

Story continues

Economic sanctions related to Iran's nuclear programs are to be rolled back after the U.N. nuclear agency confirms compliance.

Zarif told reporters the agreement would show "our program is exclusively peaceful, has always been and always will remain exclusively peaceful," while not hindering the country's pursuit of atomic energy for civilian purposes.

"We will continue enriching," he said. "We will continue research and development." He said the heavy water reactor would be "modernized."

"We have taken a major step but are still some way away from where we want to be," Zarif said, calling Thursday's preliminary step a "win-win outcome." He voiced hope that a final agreement might pave the way for a broader easing of suspicion between the U.S. and Iran, which haven't had diplomatic relations since the 1979 overthrow of the shah and subsequent U.S. Embassy hostage crisis in Tehran.

The leaders spoke following weeklong talks that were twice extended past a March 31 deadline for a preliminary deal. Negotiators worked concurrently on documents describing what needs to be done for the final agreement.

The U.S. and its five partners want to curb Iran's nuclear technologies so the country cannot develop weapons. Tehran denies such ambitions but is negotiating because it wants economic sanctions to be lifted.

The final breakthrough came a day after a flurry of overnight sessions between Kerry and Zarif, and meetings involving the six powers.

Zarif said the all-night negotiation at such a senior level was "probably a record." Iran has no intention of violating an agreement it has put so much effort into crafting, he said.

Israeli leaders, deeply concerned about Iran's intentions, were much less positive.

Prime Minister Benjamin Netanyahu said a final agreement "must significantly roll back Iran's nuclear capabilities and stop its terrorism and aggression."

The Obama administration also faces strong domestic pressure. Critics in Congress are threatening to impose new sanctions over what they believe is a bad deal taking shape.

In the Rose Garden, Obama said the issues at stake are "bigger than politics."

"These are matters of war and peace, and they should be evaluated based on the facts," he said.

AP writers Julie Pace and Bradley Klapper contributed to this report from Washington.