A security official stands in front of the Bushehr nuclear reactor

Iranian officials met this week with their six-power counterparts to try to hammer out the outlines of a comprehensive nuclear deal set to last for several years. But its precise duration remains undecided.

Reaching an agreement will be a monumentally challenging task because all the parties have veered away from international law and are trying to make ad hoc arrangements. They should instead aim for a permanent, straightforward and legal solution whose basis already exists. Successfully sealing a deal with Iran may also help Western efforts to stabilize the situation in Iraq, where Iranian and Western interests align.

Late last year, the United States, Britain, China, Russia, Germany and France reached an interim deal with Iran to freeze and roll back some of its nuclear program in exchange for limited relief from sanctions. These interim arrangements are set to expire July 20. According to the agreed “Joint Plan of Action,” another six-month stopgap deal may be signed after the first one expires. But a comprehensive long-term agreement should be reached within a year, by late January 2015.

EU Foreign Policy Chief Ashton and Iranian Foreign Minister Javad Zarif wait for the begin of talks in ViennaThough there was a great deal of optimism initially, the negotiations have recently bogged down, with the duration of the comprehensive deal a sticking point. Tehran appears to favor a three-year timeframe, while Washington insiders have suggested a 10-year or 20-year agreement.

The timeframe is important because, according to the existing Joint Plan of Action, after the comprehensive deal expires, “the Iranian nuclear program will be treated in the same manner as that of any non-nuclear weapon state party to the Nuclear Non-Proliferation Treaty” — meaning leniently.