TEHRAN, Iran -- Iranian Foreign Minister Mohammad Javad Zarif resigned without warning late Monday, offering an "apology" to the nation as the nuclear deal he negotiated with world powers is on the verge of collapse after the U.S. withdrawal from the accord.

Zarif's resignation, if accepted by Iran's relatively moderate President Hassan Rouhani, would leave the cleric without one of his main allies in pushing the Islamic Republic toward further negotiations with the West.

It remains unclear why Zarif chose to leave his post now and what effect it will have on the atomic accord, which Iran has been complying with. He likely briefed Supreme Leader Ayatollah Ali Khamenei before offering his resignation. Khamenei, who has final say on all state matters, previously backed the American-educated envoy through the nuclear negotiations.

"We'll see if it sticks," Secretary of State Mike Pompeo tweeted about Zarif's resignation. "Our policy is unchanged -- the regime must behave like a normal country and respect its people."

The veteran diplomat first hinted at his resignation with a vague Instagram post in which he offered an "apology" for his "inability to continue to his service." The post included a drawing honouring Fatima, the daughter of the Prophet Muhammad, as Iranians commemorate her birth Tuesday.

A Foreign Ministry spokesman, Abbas Mousavi, confirmed to the state-run IRNA news agency minutes later that Zarif had resigned but gave no reason for his departure.

Earlier Monday, Zarif met with members of the activist group Code Pink in Tehran, smiling as he posed for a photograph with them. However, he was not seen in images later in the day showing Syrian President Bashar Assad meeting with Khamenei and Rouhani. Iran has been one of Assad's main supporters during the years-long war in Syria.

On Sunday, Zarif criticized Iranian hard-liners in a speech in Tehran, saying: "We cannot hide behind imperialism's plot and blame them for our own incapability."

"Independence does not mean isolation from the world," he said.

Analysts say Rouhani faces growing political pressure from hard-liners within the government as the nuclear deal unravels. Iranian presidents typically see their popularity erode during their second four-year term, but analysts say Rouhani is particularly vulnerable because of the economic crisis assailing the country's rial currency, which has hurt ordinary Iranians and emboldened critics to openly call for his ouster.

Reaction to Zarif's resignation was swift. A prominent reformist lawmaker, Mostafa Kavakebian, wrote on Twitter that Rouhani should reject Zarif's resignation as his departure would only "make enemies of Iran's dignity happy."

Hassan Mohammadi, a Tehran-based political analyst close to Rouhani, said he understood it was Zarif's third time submitting his resignation in the last year.

"It is part of plan for changing the track in foreign policy in Iran. A negotiation-seeking foreign minister is not a favoured person anymore," Mohammadi told The Associated Press. "Iran needs a tough foreign minister from now on. Someone who does not offer smile towards the West."

The son of a wealthy family, Zarif overcame hardline objections and Western suspicions to strike the accord with world powers that saw Iran promise to limit its enrichment of uranium in exchange for the lifting of crippling economic sanctions.

But the deal was later challenged by the administration of President Donald Trump, which pulled America out of the accord. In doing so, Trump also fueled doubts of Iranians still wary of U.S. interests decades after Iran's 1979 Islamic Revolution. Zarif himself faced withering criticism at home after he shook hands with President Barack Obama.

Meanwhile, officials in the Trump administration have also been pressuring Iran through social media, with one State Department official tweeting an unflattering GIF of Zarif saying: "How do you know ΓåòJZarif is lying? His lips are moving."

Zarif, 59, served as Iran's ambassador to the United Nations from 2002 to 2007, first under reformist President Mohammad Khatami and then under hardline President Mahmoud Ahmadinejad.

Ahmadinejad wanted him replaced, but Supreme Leader Ayatollah Ali Khamenei intervened to keep him in the position for another two years as Iran soon found itself an international pariah over its nuclear program. Iran insisted its atomic program was for peaceful purposes only, while the West feared it could be used to make nuclear weapons.

Secret backchannel talks between the United States and Iran in Oman became full-fledged negotiations over its nuclear program. During the talks, Zarif met with then-U.S. Secretary of State John Kerry more than 50 times -- something that would have been unimaginable only a few years earlier.

Kerry and Zarif's rapport extended beyond just the nuclear negotiations. Kerry directly reached out to his counterpart in January 2016 to help secure the release within 24 hours of 10 U.S. Navy sailors seized by Iran after they mistakenly entered Iranian territorial waters.

Cliff Kupchan, chairman of the Eurasia Group and a longtime Iran watcher, described Zarif's resignation as a "bolt from the blue" from a diplomat who had served as "the face of Iran" for years. He said that while it was still too early to determine what prompted Zarif's resignation, it didn't necessarily signal a major shift away from the nuclear deal.

"I think Zarif can charm the fangs off a snake and has done so many, many times," Kupchan told AP. "Whether it's dealing with Bashar Assad or (Russian President) Vladimir Putin, he's their ambassador to a very tough neighbourhood."

"The Iranians are pretty good at making their life even harder than it has to be and this would be another step in that direction if he was forced out," Kupchan said.

------

Associated Press writer Nasser Karimi reported in Tehran and AP writer Jon Gambrell reported from Dubai, United Arab Emirates.