The Senate needs answers from Gen. David Petraeus and Leon Panetta on Iran. With all the international focus on the Arab spring, what has escaped attention is the power struggle going on inside Iran between President Mahmoud Ahmadinejad and his erstwhile protector, the supreme leader Ayatollah Ali Khamenei.

Right now it looks like Khamenei is circling the wagons. He has slapped down Ahmadinejad, who showed signs of wanting to groom his chief of staff to succeed him as president. In the most obvious sign of displeasure, Khamenei overruled Ahmadinejad, who had sought the resignation of the intelligence chief, Heydar Moslehi. Ahmadinejad’s response was to disappear from public view and in the past week not to show up to chair two Cabinet meetings.

The supreme leader clearly takes a dim view of the president consolidating his power, in particular on the nuclear issue, on which Khamenei sets the policy. I hear that Ahmadinejad has offered his resignation, and there have also been Iranian reports that there is a move in parliament to impeach him for his insubordination.

It’s not the first time that Ahmadinejad has gotten into hot water with the boss. In October 2009, he backed a nuclear fuel swap deal with the West, saying that “the conditions are ripe for nuclear cooperation at international levels,” only to face a barrage of domestic criticism from all sides. That deal has never been implemented although negotiations have not been formally broken off. Last December, he fired the foreign minister, Manouchehr Mottaki, without consulting the supreme leader.

It’s ironic that Ahmadinejad, the man the West loves to hate, in this context is the dove who would engage with the West, while the supreme leader is the hawk — both hailing from inside the country’s conservative faction.

If there is to be a militarization of U.S. intelligence with the arrival of Petraeus as head of the CIA, it will be critical to find out in the Senate confirmation hearings what his views are on tackling Iran. The same goes for Panetta as the next Defense secretary and his views about keeping “all options on the table.” There are huge foreign-policy challenges out there right now, and Iran remains one of the biggest.