An Iranian diplomat who helped to negotiate the 2015 nuclear agreement will be Iran’s ambassador to the United Nations, state media said Tuesday, filling a vacancy that had lasted five months.

The appointment of the envoy, Majid Takht Ravanchi, 60, was considered a sign that Iran will try to preserve the agreement, even though the Trump administration has renounced it, reimposing onerous sanctions and taking other steps to isolate the country.

Iran’s supreme leader, Ayatollah Ali Khamenei, also has increasingly criticized the nuclear agreement for showing what he called the mistake of trusting the United States and other Western powers that were parties to the accord. But Ayatollah Khamenei has not repudiated the accord, which was meant to end Iran’s economic isolation in return for its verified promises of peaceful nuclear work.

The ambassador job at the United Nations is considered Iran’s most important foreign diplomatic posting. Mr. Takht Ravanchi will be the highest-ranking Iranian official in the United States, which has no diplomatic relations with Iran.