Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Iranian President Hassan Rouhani rejected the resignation of Foreign Minister Mohammad Javad Zarif on Wednesday, standing by a moderate ally long targeted by hardliners in internal factional struggles over a 2015 nuclear deal with the West.

Zarif — a U.S.-educated veteran diplomat who helped craft the pact that curbed Iran's nuclear program in return for sanctions relief — announced his resignation on Instagram on Monday.

"As the Supreme Leader has described you as a 'trustworthy, brave and religious' person in the forefront of resistance against widespread U.S. pressures, I consider accepting your resignation against national interests and reject it," Rouhani said in a letter published on state news agency IRNA.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

In another show of confidence, senior Revolutionary Guards commander Qassem Soleimani said Zarif was the main person in charge of Iranian foreign policy and he was supported by the Supreme Leader, Ayatollah Ali Khamenei.

On Wednesday, Zarif thanked Iranians for their support. "As a modest servant I have never had any concern but elevating the foreign policy and the status of the foreign ministry," he added in an Instagram post.

After Rouhani's announcement, the semi-official ISNA news agency reported that Zarif had attended a ceremony to welcome Armenia's prime minister to Tehran.

Zarif gave no specific reasons for his resignation.

Iran's Foreign Minister Javad Zarif Murad Sezer / Reuters file

But his move thrust the schism between Iran's hardliners and moderates into the open, effectively challenging Khamenei to pick a side.

The split over the nuclear deal shows the tension in Iran between the two factions, and between the elected government which runs the country on a day-to-day basis and a clerical establishment with ultimate power.

An ally of Zarif told Reuters his resignation was motivated by criticism of the nuclear accord, under increasingly intense fire in Iran since the United States abandoned it last year.

Since the United States walked out of the nuclear deal and reimposed sanctions, Rouhani has had to explain why Iran has continued to abide by its restrictions while reaping virtually none of the foreseen economic benefits.