GAZA/JERUSALEM (Reuters) - Israel launched air strikes on the Palestinian enclave of Gaza and deployed extra troops to the border on Monday in response to the longest-range Hamas rocket attack to cause casualties in years.

After a day of intense cross-border fighting, Palestinian officials said Egypt had mediated a ceasefire, though the frontier did not remain calm for long.

Rocket sirens sounded in southern Israel after the late-night truce was supposed to take effect, sending residents running for shelter. In Gaza, Palestinians reported Israeli planes attacked at least two targets.

Hamas, the Islamist militant group that rules Gaza, and smaller Palestinian factions put out a statement that Egypt had mediated a ceasefire even as the rockets were fired. Israeli officials did not comment on whether a truce had been reached.

Monday’s violence began when seven Israelis were wounded near Tel Aviv by a morning rocket attack. The Gaza health ministry said five Palestinians were later wounded by a wave of retaliatory strikes.

Dozens of explosions rocked the coastal enclave and ambulance sirens echoed in the mostly empty streets. In one Gaza neighborhood, people rushed to buy bread in anticipation of a long escalation. The office of Hamas chief Ismail Haniyeh was one of the initial targets hit, although he was likely to have been evacuated in advance.

Gaza militants fired barrages of rockets into Israel late into the night. Some were shot down by Israeli defenses and others landed in empty areas.

The escalation came just two weeks before an election in which Prime Minister Benjamin Netanyahu is fighting for his political life after a decade in power, campaigning on a tough line against Palestinian militants.

Beset by corruption scandals, he faces a strong challenge from a centrist coalition led by a top general.

Netanyahu cut short a visit to the United States, saying he would fly home right after meeting President Donald Trump.

“Israel will not tolerate this. I will not tolerate this,” Netanyahu said. “And as we speak... Israel is responding forcefully to this wanton aggression.”

Trump told reporters with Netanyahu at his side that Israel has the “absolute right” to defend itself.

In the last Gaza war in 2014, more than 2,100 Palestinians, most of them civilians according to the Gaza health ministry, were killed in seven weeks of fighting. Sixty-six Israeli soldiers and seven civilians in Israel were killed.

HAMAS ATTACK

The Israeli military said Hamas launched the rocket that destroyed a house in Mishmeret, a village north of Tel Aviv. There was no claim of responsibility for the early morning attack.

The military said Hamas fired the rocket from about 120 km (75 miles) away, making it the longest-range attack from Gaza causing casualties since the last war in Gaza in 2014.

Israel has waged three wars on Gaza since Hamas took control of the territory in 2007. Israeli air strikes in retaliation for rockets from Gaza are a frequent occurrence, but Israel’s swift mobilization of extra troops to the border area was unusual.

Slideshow ( 6 images )

The two sides have managed to avert all-out war for five years, most recently with the help of Egyptian mediation after a major escalation in November last year.

Some of the other initial targets struck in Gaza, likely to have been evacuated, were the internal security office of Hamas, a naval base, a training camp and an insurance office in Gaza city, Palestinian security officials said.

U.N. Secretary-General Antonio Guterres urged restraint from both sides and said that, together with Egypt, the United Nations was trying to help defuse the situation.

Slideshow ( 6 images )

WIDE RANGE OF SCENARIOS

Israel’s Magen David Adom ambulance service said it treated seven people after the morning missile strike, including an infant, a 3-year-old boy, a 12-year-old girl and a 60-year-old woman suffering from blast injuries, burns and shrapnel wounds.

The Israeli military said it was assigning two brigades to the Gaza area and some reservists were being called up. Reuters journalists saw troops moving toward the border, where the military also closed several roads to civilian traffic.

“We are prepared for a wide range of scenarios,” chief spokesman Ronen Manelis said.

Israeli towns near Gaza and Tel Aviv, Israel’s commercial capital, opened bomb shelters in anticipation of rocket strikes.

The rocket attack coincided with tension ahead of the March 30 anniversary of the start of weekly Gaza protests at the frontier in which some 200 Gazans have been killed and thousands wounded by Israeli fire. One Israeli soldier has been killed.

Israel says it has no choice but to use deadly force at the protests to prevent militants from breaching the border fence.

Gaza is home to 2 million Palestinians, most of them descendants of people who fled or were driven from homes in Israel when it was founded in 1948. The protesters demand the right to return to land from which their ancestors fled.

Israel seized Gaza in a 1967 and pulled out its troops in 2005. Since Hamas took over two years later, Israel has maintained a security blockade, along with Egypt, that has reduced Gaza’s economy to what the World Bank calls a collapse.

Netanyahu’s visit to Washington, after Trump said it was time to recognize Israel’s sovereignty over the Golan Heights, captured from Syria in the 1967 Middle East war, was seen at home as a bid to boost the right-wing Likud leader’s chances of a fifth term.

At their White House meeting, Trump signed a declaration codifying U.S. recognition of Israel’s hold on the strategic plateau, a dramatic shift from decades of U.S. policy. Syria called the move “a blatant attack” on its sovereignty and territorial integrity.

Netanyahu’s election prospects have been clouded by graft allegations against him. He has denied any wrongdoing.