Jordan's chief Islamic justice has resigned abruptly two days after delivering a sermon in which he chastised Gulf leaders for not doing enough to support his country financially.

Ahmad Hilayel in his Friday sermon demanded that the leaders of Gulf states share their wealth with Jordan, a statement described by some commentators as "hugely embarrassing".

"Things have reached a boiling point with us," Hilayel said, addressing the Gulf leaders. "Your brothers in Jordan are facing danger all around them, where is your help; where is your money and where are your riches?"

Hilayel's sermon drew sharp public criticism for its unusual tone, that, according to Abdel Karim al-Dughmi, a member of parliament, was tantamount to "straight-up begging".

Speaking to Al Jazeera from Jordan's capital, Amman, Dughmi said: "I don't accept what Hilayel said because we should not turn into beggars from the pulpit.

"If we have the right to money from the Gulf as per our mutual agreements, it should be demanded through different channels. Not like that."

It is not clear whether Hilayel was under pressure from the royal court to resign over his sermon.

'Inappropriate statement'

Retired army general and writer Musa al-Odwan also called Hilayel's sermon "inappropriate, and hugely embarrassing to Jordan".

Speaking to Al Jazeera from Amman, Odwan added that Hilayel, as a religious judge had "no business talking politics, or talking about our brothers in the Gulf like that".

"Hilayel should instead try to advise those who mismanaged the state's resources, rather than begging, especially since our brothers in the Gulf have always helped and supported Jordan with billions of aid money."

Salameh al-Darawi, a prominent journalist specialised in economics, said that Gulf states, particularly Saudi Arabia, have always supported the Jordanian economy with declared and undeclared economic assistance.

"Gulf states pledged $5bn to Jordan in the aftermath of the Arab Spring. In addition, Saudi Arabia, Kuwait and the UAE have supplied Jordan with free oil shipments of 200,000 barrels a year to make up for oil that it was receiving from Iraq and that was no longer available," Darawi said.

READ MORE: Jordan cracks down on activists over social media posts

Instability and war in neighbouring Syria and Iraq, Jordan's main trading partners, have added to the country's economic woes and contributed to a budget deficit that currently stands at $1.5bn.

During the same sermon, Hilayel also warned Jordanian activists who criticise the government not to take to the streets because it would be "disloyal" to do so.

The activists have been demanding more government accountability and transparency to combat public corruption.

On Thursday, security forces rounded up about 19 activists and charged them with crimes including posting statements critical of the government on Facebook.

Hilayel was the highest Islamic law judge in Jordan and was appointed by the king.

He was also the Imam of the Royal Hashemite Court, an honorific, but paid, position that requires him to lead public prayer alongside the king and recite verses whenever the king or the royal family visit gravesites of family members.