TEHRAN (Reuters) - Iran's constitutional watchdog has found President Mahmoud Ahmadinejad's decision to appoint himself caretaker oil minister illegal, the semi-official Fars news agency said on Friday.
"The Guardian Council said it was illegal for President Mahmoud Ahmadinejad to be caretaker of the Oil Ministry," Fars reported.
Ahmadinejad took control of the ministry earlier this week as he sought to merge it with the Energy Ministry in an effort to slim down the government.
It was not immediately clear if the ruling by the Guardian Council would force Ahmadinejad to relinquish the post but it would be hard for the president to ignore the voice of such an important body.
The 12-man Guardian Council -- six senior clerics appointed by the Supreme Leader Ayatollah Ali Khamenei, and six Islamic jurists -- which must ensure all laws passed by parliament comply with Islamic law and Iran's constitution.
If confirmed, it would be a fresh blow to Ahmadinejad in his power struggle with other members of Iran's conservative ruling elite, particularly over the appointment and removal of key ministers.
By law the president has three months after removing a minister -- in this case Oil Minister Massoud Mirkazemi -- to introduce a new candidate to parliament. During that period he can act as caretaker himself or appoint someone to the post.
The move on the Oil Ministry put the hardline president in direct control of the exploitation and export of Iran's huge oil and gas fields.
It also meant he would attend the next meeting of the Organization of the Petroleum Exporting Countries, set for June 8 in Vienna.
Oil analysts said Ahmadinejad's presence at the next OPEC meeting would dim any prospects of raising output targets to reduce the oil price as the president would use the occasion to drive home Iran's hawkish stance on price.
If forced to back down, it would be Ahmadinejad's second defeat on ministerial appointments in just a few weeks and would add to the sense voiced by some analysts that his grip on power is weakening.
Last month his decision to sack Intelligence Minister Heydar Moslehi was overruled by Khamenei, a rare public interference interpreted by analysts as an attempt to clip the president's wings.
The government was keen to deny any suggestion of a growing rift between Iran's two most powerful figures.
Khamenei has discretion over the key ministries dealing with oil, foreign affairs, intelligence and the interior and the final outcome of the row over the oil ministry is likely to reflect his opinion.
It will also say much about Khamenei's relation with the president he backed wholeheartedly after his disputed re-election in 2009.
The ballot triggered huge street demonstrations by protesters claiming it was rigged in favor of the incumbent. The protests, repressed by force, were the biggest challenge to Iran's ruling elite since the 1979 Islamic Revolution that overthrew the monarch.
The government says the protests were stirred up by Iran's foreign enemies.
Ahmadinejad has also been in dispute with parliament about his ministerial choices, lawmakers impeaching his transport minister in February and just one vote stopped them sacking the energy minister.
In the past weeks a dispute between parliament and government over merging the oil and energy ministries without lawmakers' approval has intensified.
Some Iranian media reported that a meeting last week resolved the dispute between Ahmadinejad and parliament speaker Ali Larijani, an outspoken critic of the president's economic policies.
(Reporting by Zahra Hosseinian; Writing by Robin Pomeroy; Editing by Jon Boyle)