World powers on Tuesday reached a historic deal on Iran's nuclear programme in exchange for sanctions relief after an 18-day negotiation marathon in Vienna.
The accord seeks to end fears dating back 13 years that the Islamic Republic may seek to build nuclear weapons, an aim it denies, under the guise of a civilian programme.
Here is a summary of the main developments during the long standoff:
2002-2004: Undeclared sites
In August 2002, an Iranian exile group reveals the existence of undeclared nuclear facilities. Iran invites the International Atomic Energy Agency (IAEA) to carry out inspections and says its activities are peaceful.
In 2003, Iran agrees with Britain, Germany and France to suspend suspect activities but the following year goes back on the pledge.
In 2004, the IAEA says it found no evidence of a secret weapons drive but cannot rule out undeclared materials. In Paris talks, Iran again agrees to suspend certain activities.
2005-2008: Escalation and enrichment
In August 2005, under hardline president Mahmoud Ahmadinejad, Tehran produces uranium gas, the precursor to enrichment for providing the core material for a bomb. European nations break off negotiations.
In 2006, Iran breaks IAEA seals on its Natanz enrichment facility and begins enrichment. The IAEA refers Iran to the UN Security Council, which in July passes the first of six resolutions.
In August, Ahmadinejad inaugurates a heavy water plant at Arak, raising fears Iran might be seeking weapons-grade plutonium. December's second UN Security Council resolution comes with sanctions attached. The US and EU follow suit.
By November 2007, Iran says it has at least 3,000 centrifuges for enrichment, which in theory would allow it to produce enough enriched uranium for a nuclear bomb in less than a year. Today it has nearly 20,000, of which half are active.
In December 2007, a US National Intelligence Estimate report says "with high confidence" that in 2003 Iran halted efforts to develop nuclear weapons, but "at a minimum" is keeping open an option to resume.
In September 2009, US, French and British leaders announce Iran is constructing an undeclared enrichment site at Fordo, built into a mountain near Qom.
In October, Iran agrees to swap low-enriched uranium for reactor fuel. But the deal unravels and in February 2010 Iran begins enriching uranium to close to bomb-grade - for nuclear medicine, it says.
Another fuel swap plan, this time involving Brazil and Turkey, falls apart.
In 2011, the Russian-completed Bushehr power reactor - first begun by Germany's Siemens - begins operating.
In November 2011, an IAEA report, collating "broadly credible" intelligence, says that at least until 2003 Iran "carried out activities relevant to the development of a nuclear explosive device".
The following month the US Congress passes legislation sanctioning lenders who deal with Iran's central bank. In January the EU bans all member states from importing Iranian oil.
Israeli Prime Minister Benjamin Netanyahu, whose country is widely assumed to have nuclear weapons, brandishes a diagram of a bomb at the UN General Assembly, calling for a "clear red line" to be drawn under Iran's programme.
2013-2015: 'Serious' talks
Newly elected Iranian President Hassan Rouhani vows in 2013 he is ready for "serious" negotiations. He and US President Barack Obama hold an unprecedented phone call.
In November, an interim deal is agreed freezing some of Iran's nuclear activities in exchange for minor sanctions relief. Two deadlines -July and November 2014 - to agree a final deal are missed.
In April 2015, Iran and major powers agree in Lausanne, Switzerland the main outlines of a final deal.
In late June, talks begin in Vienna seeking to finalise the accord, but several deadlines are missed over 18 tortuous days of talks before the final breakthrough comes on July 14.