Iran's parliament said on Wednesday President Mahmoud Ahmadinejad acted illegally by declaring himself caretaker oil minister and referred the case to the judiciary, increasing pressure on him to quit the post. The legislature, which has repeatedly clashed with Ahmadinejad over key policy issues, voted to approve a report by its energy committee which found Ahmadinejad's move an "obvious violation of law", the semi-official Mehr news agency reported. Last month Ahmadinejad sacked Oil Minister Massoud Mirkazemi as part of a plan to merge several ministries to cut their number to 17 from 21, alarming his rivals within the conservative ruling elite. The president has the power to remove ministers and put caretakers in place for up to three months before having to consult parliament, and he says no one should be surprised by the reshuffle which has been on the cards for some time. But taking personal control of the ministry that exploits Iran's vast oil resources was seen by some as a power grab to gain tighter control over the Islamic Republic's petro-dollars and a challenge to other arms of government. "This illegal and hasty action will undermine the Islamic Republic of Iran's interests on the international level," the conservative-dominated parliament said in its report. "Mr Ahmadinejad as oil minister has issued some orders and will continue to issue orders which are obvious examples of illegal interference with governmental financial resources." Iran's constitutional watchdog body, the Guardian Council, has already said Ahmadinejad's takeover of the oil ministry was illegal. But the president has given no sign of backing down other than saying he would not attend an OPEC meeting in Vienna next week and would send a minister instead, most likely Economy Minister Shamseddin Hosseini, according to Mehr. Iran is the second-largest producer in the Organization of the Petroleum Exporting Countries and holds the largely symbolic rotating presidency of the group which meets in Vienna next Wednesday. The final say on the oil ministry lies with Supreme Leader Ayatollah Ali Khamenei -- whose wholehearted backing for Ahmadinejad since his disputed re-election in June 2009 can no longer be taken for granted, according to some analysts. Khamenei stopped Ahmadinejad from dismissing his intelligence minister in April, seen as a rare intervention to clip the president's wings, and one of his top aides recently called on Ahmadinejad to "turn back to the main path". The power struggle comes less than a year before parliamentary elections in which prominent opposition figures are unlikely to be allowed to run, and rival conservative factions will battle for control of the legislature in the absence of a strong reformist field.