TEHRAN, Iran (AP) _ In calling for closer ties with America after nearly two decades of hostility, Iranian President Mohammad Khatami is taking his biggest political gamble since taking office nearly five months ago.

His move has popular backing but is opposed by the hard-line clergy that has ruled Iran since the 1979 Islamic revolution. The result may be a culmination of a battle that has simmered for years in Iran: the power struggle between hardliners and moderates.

Even before Khatami's gesture to the United States, his rivals had started maneuvering against him.

Both factions had agreed to a tacit cease-fire during a high-profile Islamic summit last week, but the hardliners appeared to resume their attacks on Sunday with the arrest of Ebrahim Yazdi, head of Iran's token legal opposition group.

Yazdi's Freedom Movement said in a statement that he was summoned to a revolutionary court for questioning and then taken to Evin prison in north Tehran. No charges have been filed against him, the group said. The judiciary is controlled by the hardliners.

Khatami has called for more freedom of speech and has relaxed press censorship since being sworn in as president Aug. 4. Yazdi's group had been operating with Khatami's blessing, and his arrest appears to be an effort to tarnish the government's image.

``We think that this is an effort by Mr. Khatami's rivals to weaken him, just as he is making positive moves. This will only result in weakening him,'' said Ali Akbar Moinfar, a member of the Freedom Movement and a close friend of Yazdi.

To the dismay of hardliners, Khatami won a landslide election victory in May. He has popular support in his bid to change Iran's foreign policy because Iranians have tired of being cast as a pariah state by the United States and the West.

More than half of Iran's 60 million people are too young to remember the U.S.-backed shah who was overthrown in the 1979 Islamic revolution. For them ``death to America,'' the ever-present slogan of the revolution, has little resonance, and they like what they see in their new president so far.

Iran's religious government was rocked last month when a senior cleric, Grand Ayatollah Hossein Ali Montazeri, questioned the legitimacy of Iran's supreme leader, Ayatollah Ali Khamenei, who is revered across the board by hard-liners.

Without any apparent evidence, the hardliners have accused Yazdi of being behind the move.

Montazeri's home in the holy city of Qom was attacked by Muslim militants, and he was forced to escape under police protection after he criticized Khamenei in a lecture.

Khamenei, whose powers are virtually unlimited, has been the main obstacle for Khatami's reforms. He retains control over foreign policy, the interior and intelligence ministries, and the armed forces.

Montazeri did serious damage to the idea that Khamenei was beyond question or criticism when he asked whether a non-elected leader should be more powerful than the elected president.

Since being sworn in as president in August, Khatami has endorsed Khamenei's legitimacy in public, but he has gained immensely from Montazeri's move: Khamenei can no longer veto Khatami on important issues without exposing himself to criticism.

Khamenei, who controls foreign policy and is vehemently anti-American, can quash Khatami's opening to the United States. But he has been surprisingly silent since Khatami announced Sunday that he wants to start a dialogue with the American people.

The hard-liners, who have maintained a silence since Khatami's comments about the United States, may not attack him head-on for fear of a popular backlash.

But some Iranians fear for the safety of Khatami, who eschews ceremony and travels around Tehran with minimum security.

``Mr. Khatami is going against nearly the whole establishment, and there are powerful forces who may try to stop what he is doing at any cost,'' said Hamid Shirazi, a civil servant who voted for Khatami.