The head of Iran's judiciary lashed out at the country's president Wednesday, the latest salvo in an escalating political conflict that has undermined much of Mahmoud Ahmadinejad's political clout.

The latest issue appeared relatively minor — Ahmadinejad's intention to visit a prison north of Tehran. The head of the judiciary branch, Ayatollah Sadeq Larijani, said permission from his office was needed to visit Evin prison, and Ahmadinejad angrily rejected that. Larijani retorted Wednesday that the president does not understand his constitutional powers.

One of Ahmadinejad's aides is being held at the prison.

The background is a longstanding clash between Ahmadinejad and Iran's powerful clerics, as presidential elections loom next year. Ahmadinejad cannot run for another term but wants to influence the race to succeed him. His supporters were soundly defeated in parliamentary elections earlier this year.

Ahmadinejad originally had the backing of the clerics, but they broke over his perceived challenge to the authority of Supreme Leader Ayatollah Ali Khamenei last year. The conflict is mostly over internal politics. The two leaders do not differ significantly over policies, especially Iran's contentious nuclear development program.

The latest spat revolves around Ahmadinejad's request to visit the prison where his top press adviser, Ali Akbar Javanfekr, was sent last month after being convicted of publishing material deemed insulting to Khamenei.

On Monday, Ahmadinejad sent a letter accusing the judiciary of "unconstitutional" behavior for rejecting his planned visit to Evin prison. As the country's elected president, he said he did not need permission.

Larijani returned the fire Wednesday.

"(Ahmadinejad's) letter is the result of incorrect understanding of the responsibilities of the three branches of power and the limits of duties," the semi-official ISNA news agency quoted Larijani as saying.

Addressing judicial authorities Wednesday, Larijani said Ahmadinejad does not control the judiciary.

"This assumption that the president has supervision over other branches of power is totally wrong," he was quoted by ISNA as saying. "It is unconstitutional to claim that the president has the right to visit prisons without permission from the judiciary."

The three branches of power operate under the supervision of Khamenei, who has the final say on all state matters.

One of Khamenei's representatives, Ali Saeedi, was quoted by Iranian newspapers this week as charging that Iran's presidents sometimes put themselves in the position of the Supreme Leader and seek to exercise powers well beyond what has been given to them under the constitution — a clear reference to the clash between Ahmadinejad and Khamenei.

Iran's state prosecutor, Gholam Hossein Mohseni Ejehi, said Sunday that the judiciary rejected Ahmadinejad's request to visit the prison because it appeared to be politically motivated.

Ejehi said Ahmadinejad would do better to focus on Iran's deepening economic problems than to visit Evin. He also asked why the president never asked to visit Evin in his seven years as president but wants to go there now that his close aide is behind bars.