Muhammed Muheisen, Associated Press
Demonstrators run to avoid tear gas canisters fired by Israeli troops Friday during a protest against Israel's separation barrier in the West Bank village of Bilin, near Ramallah. Israel says the barrier is necessary for security while Palestinians call it a land grab.

JERUSALEM — The prime minister of Israel, Ehud Olmert, warned Friday that Israel could soon opt for a major military operation in Gaza to try to stop rocket and mortar fire from the area that has killed three Israelis in the past month.

Landing in Israel after a brief visit to Washington, Olmert told reporters that he was still considering the alternative option: an Egyptian-brokered temporary cease-fire with Hamas, the Islamic group that controls Gaza, and other militant organizations there. But "based on the data as I see it now," he said, "the pendulum is closer to a decision for a serious operation."

The Israeli defense minister, Ehud Barak, hinted late Thursday of an imminent army operation, saying that it was "closer than ever." He suggested that one was necessary before any cease-fire.

There have been plans for broad military action for months. In the winter, military officials said they were waiting for weather conditions to improve.

In the meantime, Egypt has been trying to broker understandings to establish calm.

Israel demands that any cease-fire arrangement put a stop to weapon-smuggling from Egypt into Gaza. Hamas wants a halt to all Israeli strikes and incursions in the area and an easing of the Israeli-imposed economic blockade. Thousands of Palestinians demonstrated near the Rafah crossing on the Gaza-Egypt border on Friday afternoon to protest its closure.

Israel worries that Hamas will exploit a period of calm to build up its strength, and most of the Cabinet seems to be tending toward the military option. But military officials have warned that a large-scale action could cost many lives on both sides and prove indecisive.

In Gaza, Sami Abu Zuhri, a spokesman for Hamas, said that "Olmert's threats are proof" that the United States has given "a green light to launch a new round in the war against Gaza."

Referring to a new corruption probe against the Israeli prime minister, Abu Zuhri told Reuters that a large military operation would lead to Olmert's downfall "not because of the scandals but because of the graves of his soldiers that will have to be dug."

In more tough talk in Israel on Friday, Shaul Mofaz, a deputy prime minister and minister of transportation, told the Yediot Aharonot newspaper that "if Iran continues its program to develop nuclear weapons, we will attack it."

Mofaz, a former defense minister and army chief, said that sanctions were not effective.

He was the first senior member of the Israeli government to threaten Iran overtly. Earlier this week, the foreign minister and vice prime minister, Tzipi Livni, said it was important to keep a military option against Iran on the table. But she added that the clearer the point was made to Tehran, the less chance it would have to be used.

Iran insists that its nuclear program is for civilian purposes only.

An Israeli attack on Iran would be risky and difficult, according to experts here, because of the long distances involved, the need to hit multiple targets and the threat of retaliation which some fear could include non-conventional terrorism.

Mofaz is a candidate to replace Olmert at the helm of the ruling Kadima Party in the event of the prime minister's downfall. Earlier this week Mofaz took a hard line on the indirect talks now under way between Israel and Syria, rejecting the idea of returning the Golan Heights, a strategic territory Israel seized in the 1967 war, in return for a peace deal.