Close allies of Iran's president, Mahmoud Ahmadinejad, have been accused of using supernatural powers to further his policies amid an increasingly bitter power struggle between him and the country's supreme leader, Ayatollah Ali Khamenei.

Several people said to be close to the president and his chief of staff, Esfandiar Rahim Mashaei, have been arrested in recent days and charged with being "magicians" and invoking djinns (spirits).

Ayandeh, an Iranian news website, described one of the arrested men, Abbas Ghaffari, as "a man with special skills in metaphysics and connections with the unknown worlds".

The arrests come amid a growing rift between Ahmadinejad and Khamenei which has prompted several MPs to call for the president to be impeached.

On Sunday, Ahmadinejad returned to his office after an 11-day walkout in an apparent protest over Khamenei's reinstatement of the intelligence minister, who the president had initiallyasked to resign.

Ahmadinejad's unprecedented disobedience prompted harsh criticism from conservatives who warned that he might face the fate of Abdulhassan Banisadr, Iran's first post-revolution president who was impeached and exiled for allegedly attempting to undermine clerical power.

Ayatollah Mesbah Yazdi, a hardline cleric close to Khamenei, warned that disobeying the supreme leader – who has the ultimate power in Iran – is equivalent to "apostasy from God".

Ahmadinejad has so far declined to officially back Khamenei's ruling over Heydar Moslehi, the minister at the centre of the row. In the first cabinet meeting since the president returned, Moslehi was absent.

Khamenei's supporters believe that the top-level confrontation stems from the increasing influence of Mashaei, an opponent of greater involvement of clerics in politics, who is being groomed by Ahmadinejad as a possible successor.

But the feud has taken a metaphysical turn following the release of an Iranian documentary alleging the imminent return of the Hidden Imam Mahdi – the revered saviour of Shia Islam, whose reappearance is anticipated by believers in a manner comparable to that with which Christian fundamentalists anticipate the second coming of Jesus.

Conservative clerics, who say that the Mahdi's return cannot be predicted, have accused a "deviant current" within the president's inner circle, including Mashaei, of being responsible for the film.

Ahmadinejad's obsession with the hidden imam is well known. He often refers to him in his speeches and in 2009 said that he had documentary evidence that the US was trying to prevent Mahdi's return.

Since Ahmadinejad's return this week, at least 25 people, who are believed to be close to Mashaei, have been arrested. Among them is Abbas Amirifar, head of the government's cultural committee and some journalists of Mashaei's recently launched newspaper, Haft-e-Sobh.

On Saturday, Mojtaba Zolnour, Khamenei's deputy representative in the powerful Revolutionary Guard, said: "Today Mashaei is the actual president. Mr Ahmadinejad has held on to a decaying rope by relying on Mashaei."