Iran said Tuesday that a German held in Iran has been released as part of a prisoner swap for an Iranian held in Germany on suspicion of violating US sanctions.

"We announced that we are ready to (release) this German national... on condition that they (the Germans) do not extradite our citizen to America," judiciary spokesman Gholamhossein Esmaili said.

"On Sunday... the Iranian national left Germany and entered Iran, and on Monday... we released the German national," he told a televised news conference.

According to the official, the unidentified German had been detained "for some time" for "taking photos and videos" in areas without authorisation and had been serving a three-year prison sentence.

The German was swapped for Iranian Ahmad Khalili, who according to Iran's foreign ministry was detained in Germany "on the pretext of violating the illegal and cruel sanctions of the United States".

Iran had said it was open to further prisoner swaps after releasing Chinese-born American Xiyue Wang in December in exchange for an Iranian scientist
Iran had said it was open to further prisoner swaps after releasing Chinese-born American Xiyue Wang in December in exchange for an Iranian scientist US State Department / HO

Khalili was freed on Sunday night after "intensive diplomatic consultations" and cooperation involving the judiciary and the Revolutionary Guards' intelligence service, ministry spokesman Abbas Mousavi said in a statement.

He returned to Iran together with Foreign Minister Mohammad Javad Zarif, who last week attended a security conference in the German city of Munich, Mousavi added.

Iran said in December it was ready for more prisoner swaps with the US after it secured the return of scientist Massoud Soleimani in exchange for Xiyue Wang, a Chinese-born American held in the Islamic republic.

Decades-old tensions between Tehran and Washington have escalated steeply since 2018, when US President Donald Trump unilaterally withdrew from a landmark 2015 nuclear deal and reimposed sanctions on Iran.

Soleimani, a stem cell researcher at a Tehran university, on December 7, also flew back home from the United States with Zarif.