JERUSALEM — A truce between Israel and Hamas went into effect this morning, hours after the two sides launched attacks that highlighted the difficulties they face in holding the cease-fire together.

After a year of violence that has killed more than 400 Palestinians and seven Israelis, the leaders of both sides expressed hope the truce, which went into effect at 6 a.m., would succeed — but made clear they have little faith in their adversaries' commitment to the deal.

"I hope it will succeed. I believe there will be quiet in (Israel's) south," Israeli Prime Minister Ehud Olmert said in a speech to philanthropists. But he also said he instructed his military "to prepare for any operation, short or long, that might be necessary" if the truce breaks down as several previous ones have.

In another diplomatic initiative, Israel called on neighboring Lebanon to open peace negotiations — an overture that was quickly rejected by Lebanon's prime minister.

In Gaza, Hamas Prime Minister Ismail Haniyeh said the truce would ease the lives of Gazans, but success or failure was in Israel's hands. "The calm is going to bring stability to Israel if they commit themselves to it," he said.

The truce deal between Israel and Hamas was reached after months of efforts by Egypt and could avert a large-scale Israeli military incursion. The talks were brokered by Egypt because Israel, like much of the international community, shuns Hamas for refusing to recognize Israel or renounce violence.

But on Wednesday, violence was still in evidence and a truce seemed remote. The military said at least 40 rockets and 10 mortar shells exploded in Israel by nightfall, an especially high one-day total.

Islamic Jihad claimed responsibility for much of the rocket fire, saying it was to avenge Israeli airstrikes that killed 10 militants in the previous two days. Israel hit back with two more airstrikes, wounding two Palestinians, according to Hamas security officials.

One of the militant rockets exploded in Ilan Basherim's greenhouse at Moshav Yesha, not far from Gaza. The 38-year-old Israeli said a truce would not improve security for border communities like his.

"This cease-fire will give more strength to Hamas, and they will be more violent in another six months. This is not good for Israel, and definitely not good for us," Basherim said.

Palestinians in Gaza have suffered the consequences of punishing Israeli retribution — airstrikes and military raids targeting gunmen and a blockade that has cut off many vital supplies. Israelis in communities near the Gaza Strip have lived for years with barrages of mortars and rockets that send them scrambling for cover almost every day.

According to the truce terms, militants will immediately halt their attacks on Israel, and Israel will cease its raids.

After three days, Israel is to ease the Gaza blockade, and a week later Israel will further ease restrictions at cargo crossings. In a final stage, the sides are supposed to talk about opening a major border crossing between Gaza and Egypt and the return of an Israeli soldier held in Gaza by Hamas militants for two years. The truce is supposed to last for six months.

A cease-fire in November 2006 lasted only weeks before unraveling.

In Washington, White House deputy press secretary Gordon Johndroe was hopeful.

"We hope this means no more rockets will be fired by Hamas at innocent Israelis as well as lead to a better atmosphere for talks between Israel and the Palestinian Authority," he said. "But for that to happen, Hamas has to choose to become a legitimate political party and give up terrorism."

Khaled Abdel Halem, a 24-year-old Gaza law student, said he would be happy if Israel lifted the blockade, alleviating Gaza's abject poverty.

"But honestly, I don't have much hope that this agreement will hold for a long time. We are not talking about an agreement between friends or brothers. We are talking about a deal between two enemies who wish death for each other all the time," he said.

Peter Lerner, an Israeli military spokesman, said preparations were under way to increase the number of trucks carrying goods into Gaza beginning Sunday if the truce holds. Only one crossing is currently capable of operating at full capacity because two others have been damaged by Palestinian attacks, he said.

Lerner said fuel shipments would not immediately increase. Israel has restricted fuel supplies into Gaza, causing shortages and forcing motorists to use alternative modes of transportation.

Israel's call on Lebanon to open peace talks came after the second round of indirect talks between Israel and Syria in Turkey — contacts made public just last month.

Government spokesman Mark Regev said Israel was interested in direct, bilateral talks and ready to put "every issue of contention" on the table, including the dispute over the Chebaa Farms enclave. A U.N.-drawn border calls the 15-square-mile parcel of wasteland part of Syria under Israeli occupation, but Hezbollah insists it belongs to Lebanon and has used it to explain its continuing attacks on Israel.

Lebanese Prime Minister Fuad Saniora rejected Israel's call.

"Lebanon's known position before this government is that there is no place for bilateral negotiations between Lebanon and Israel," Saniora's media office said in a statement late Wednesday.

Hezbollah legislator Nawar al-Saheli told The Associated Press that the Israeli offer is "ridiculous propaganda."

U.S. pressure may be behind the Israeli move. On Monday, Secretary of State Condoleezza Rice announced U.S. backing for a new diplomatic push to resolve the Chebaa Farms land dispute in a gesture to the new Lebanese government, and as a catalyst for solving bigger issues in the region.