Maybe the year-plus of negotiating paid off after all.

Early this morning, Iran signed a deal with Turkey and Brazil that would enable it to pursue a civilian nuclear energy strategy, while swapping the fuel on Turkish soil to calm fears that it was enriching uranium for military purposes.

Iran said it had agreed to swap 1,200 kg of its low-enriched uranium for higher-enriched nuclear fuel, to be used in a medical research reactor. The exchange would take place in Turkey, Foreign Ministry spokesman Ramin Mehmanparast said.

Iran, which rejects Western accusations it is seeking to develop nuclear bombs, had earlier insisted such a swap must take place on its territory.

Turkey and Brazil, both non-permanent members of the U.N. Security Council, had offered to mediate to find a resolution to the impasse at a time when world powers are in talks to impose a fourth round of U.N. sanctions on Iran.

This is basically a version of the deal to which Iran tentatively agreed back in October: they would get recognition for their civilian energy policy in exchange for keeping the enrichment process outside its borders. For months Iran demanded that the fuel swap take place on Iranian soil, which was unacceptable to the other parties involved. But this swap would take place in Turkey.

Perhaps Iran was actually worried about another round of sanctions at the UN with the involvement of China and Russia (unlikely). Perhaps they wanted to focus on their internal unrest and get this issue on the other side of them. Perhaps they have some plan to game this deal. But it sure looks like they came around to agreeing to the initial offer, with Turkey and Brazil playing the key mediation roles. The fact that not one bomb was dropped or one alarm sounded shows that international impasses can be broken without belligerence or ultimatums.

Predictably, not all parties welcomed this agreement. In particular, a senior official in the right-wing government in Israel claimed that Iran was “manipulating” Turkey and Brazil to lower international pressure. They said that Iran would back off their pledge down the road. Where this agreement varies from the agreement in principle from October is that it has been signed, however.

This would represent a major foreign policy victory for sensibility and negotiation. We were very close to combat with Iran, by all accounts, over the final few years of the Bush Administration, and if this agreement holds, we will have dodged a very large bullet.