BEIRUT, Lebanon — More than 2,100 people incarcerated by the Syrian authorities were being released on Wednesday in return for 48 Iranians freed by rebels after five months in captivity, Turkish and Iranian officials said, in what appeared to be the biggest prisoner swap since the uprising against President Bashar al-Assad of Syria began almost two years ago.

The timing of the exchange, brokered by Turkey and Qatar, was notable, suggesting that negotiations over at least some aspects of the Syrian crisis had not been abandoned three days after Mr. Assad warned that he would not negotiate with his armed adversaries and dismissed calls for him to quit.

Word of the exchange came as allies of Mr. Assad and of his opponents announced that they would continue talking, at least to one another. Lakhdar Brahimi, the special Syria envoy from the United Nations and the Arab League, will meet in Geneva on Friday with senior diplomats from Russia, which has opposed efforts to unseat Mr. Assad forcibly, and the United States, which, like Turkey, supports the armed opposition and wants Mr. Assad out.

While Mr. Assad’s unbending stance seemed to make a political solution to Syria’s civil war more remote, his only major foreign allies, Russia and Iran, have their eye on maintaining regional influence in a possible post-Assad future, and an interest in ending the Syrian war with state institutions intact. They have made clear they still favor a settlement. Backers of the opposition, too, worry about chaos in Syria and the region as the fight drags on, and the prisoner exchange suggested that Turkey and Iran, at least, wanted to maintain good relations even as they find themselves on opposite sides of the Syrian conflict.