NICOSIA, CYPRUS, JAN. 7 -- Iran's Ayatollah Ruhollah Khomeini accused President Ali Khamenei today of trying to go too far in limiting the power of an Islamic government.

The rare personal attack was contained in a letter from Khomeini published in Tehran, said the official Islamic Republic News Agency, monitored here.

Parliamentary Speaker Ali Akbar Hashemi Rafsanjani, a key contender for power in a post-Khomeini Iran, welcomed the letter, and berated anyone who might deviate from the 87-year-old patriarch's line.

The developments appeared to signal a step-up in the struggle over who will rule Iran after the death of Khomeini, who reportedly is ailing. Khomeini criticized views he said the president had expressed during Friday's prayer sermon on the role of government in an Islamic society.

Although the argument was couched in religious terms, the strength of language and its targeting of a named individual, Khamenei, were unusual.

"Your observations during the Friday prayers apparently purport that you do not recognize government as an institution ordained by the Almighty and founded with absolute power entrusted to the Prophet, may God preserve him," Khomeini wrote.

"Your conclusion on the proposition, based on my earlier statement that 'government exercises power only within the bounds of the divine statutes,' is a misquote and a misinterpretation."

The agency's dispatch did not give a full explanation of Khomeini's views on the limits of government power, and it remained unclear precisely what they are. It did give several examples of powers he thought the government should have.

"Our government . . . has priority over all other Islamic tenets, even over prayer, fasting and the pilgrimage to Mecca," he was quoted as writing. Under the Shiite branch of Islam, the Koran and the sharia, or Islamic code, are perpetually reinterpreted with a view to adapting them to changing social and economic conditions.

The process of reinterpretation is bounded by various religious stipulations, but the final word at any one time comes from the religious leader, in this case Khomeini.