Iran and Sweden exchanged prisoners on Saturday, breaking a logjam that brought relief to families but also concern over capitulation to Tehran’s practice of taking foreigner citizens hostage on trumped-up charges to extract concessions.

Iran released Johan Floderus, 33, a European Union diplomat and Swedish national, who was arrested in April 2022 in Tehran, as well as Saeed Azizi, a dual national arrested in 2023, the Swedish prime minister said.

“It is with pleasure that I can announce that Johan Floderus and Saeed Azizi are now on a plane home to Sweden, and will soon be reunited with their families,” the prime minister, Ulf Kristersson, said on social media.

In exchange, Sweden released Hamid Nouri, an Iranian judiciary official who had been sentenced to life in a Swedish court for torture, war crimes and the mass execution of 5,000 dissidents in 1988 who were sent to the gallows without trial.

Kazem Gharibabadi, deputy judiciary minister and secretary general of Iran’s High Council for Human Rights, announced the release in a post on X, saying he was happy to report Mr. Nouri was “free and returning to Iran within hours.”

The swap was coordinated with the help of Oman, according to a statement published by the Omani state news agency. The prisoners on both sides were taken there before traveling on to their home countries.

A family member of Mr. Floderus said the young diplomat was on his way to Europe from Oman Saturday afternoon.

The news was welcomed by the families of the Swedes, as well as senior officials closely following the cases.

“Delighted at the news that our Swedish colleague Johan Floderus and his compatriot Saeed Azizi have been released from unjustified Iranian custody,” said the president of the European Commission, Ursula von der Leyen.

The European Union and Sweden had kept Mr. Floderus’s arrest in April 2022 in Tehran a secret until The New York Times broke the news of his detention in 2023, more than 500 days later.

But the swap, particularly the release by Sweden of Mr. Nouri, also triggered anger and concern over rewarding Iran for its systematic arrest of foreign nationals on fabricated allegations, usually of espionage or other political crimes, in order to extract concessions from Western countries.

Beyond Iran, the case of Mr. Nouri was hailed at the time of his conviction as a landmark legal case of trans-border justice in which war criminals can be arrested and convicted outside their own borders based on charges of crimes against humanity. Human rights lawyers said at the time that his case paved the way for bringing charges against officials from places like Syria, Sudan and Russia who were accused of war crimes.

Mr. Nouri was a judicial official at Gohardasht Prison near Tehran, where 5,000 people were executed in the 1988 purge. He prepared the list of names for a so-called death committee of three officials, which included the future president, Ebrahim Raisi. He then escorted the prisoners blindfolded from their cells to the committee’s room, and then to the gallows after their sentencing.

On Saturday, family members both of those victims and of the dozens of others from around the world who remain in Iranian custody were outraged by the exchange, with many taking to social media to express their frustrations. Several of those still imprisoned, like Ahmadreza Djalali, a scientist on death row on murky charges of spying and aiding Israel in assassinating nuclear scientists, are Swedish citizens. Mr. Djalali has denied the charges against him.

“This is beyond shocking,” said Mariam Claren, the daughter of Nahid Taghavia, a German-Iranian dual national who has been a prisoner in Tehran for the past four years. “Hamid Nouri was responsible for the mass killings of political prisoners in the ’80s. He was convicted in an independent and fair trial in Sweden.”

Richard Ratcliffe, whose wife, Nazanin Zaghari-Ratcliffe, a British-Iranian charity worker, spent six years in prison in Iran on false political charges, underscored the complexities of such swaps.

“I am really delighted for Johan and his family, and also Saeed,” he said. “They didn’t deserve any of this. But I am distraught for Ahmadreza and all the others left behind. Nothing about hostage diplomacy is fair.”

Olivier Vandecasteele, a Belgian humanitarian worker who was in prison in Tehran for some time with Mr. Floderus before he was released last year in another prisoner exchange, said this was a somber moment he knew all too well himself.

“When hostages are freed, there is always a mix of joy and pain,” he said. “When some get freed, it means others don’t. We know that families still awaiting their loved ones are experiencing today a very bittersweet moment.”

The prisoner swap also won’t help the thousands of Iranians who are unjustly and often brutally detained by the government.

For Iran, getting Mr. Nouri back from Sweden is a major coup. He was lured to Sweden in 2019 by his former son-in-law in coordination with international law experts and the families of the victims. He was arrested upon landing in Stockholm under the rarely used doctrine of universal jurisdiction, which empowers the authorities of any country to arrest and try any person suspected of major violations of international law who travels to their territory.

He was found guilty of war crimes and sentenced to life in prison by a Swedish court in 2022, and was appealing his sentence at the time of his release.

Vivian Nereim contributed reporting from Riyadh, Saudi Arabia, and Farnaz Fassihi from New York.

world