TEL AVIV, Israel (AP) — A bomb exploded aboard an Israeli bus near the nation’s military headquarters in Tel Aviv on Wednesday, wounding 27 people, delivering a major blow to diplomatic efforts to forge a truce to end a week of fighting between Israel and Gaza’s militant Hamas rulers. Thousands of Palestinians fled their homes in Gaza fearing Israeli airstrikes.
Hours after the bus blast, US Secretary of State Hillary Rodham Clinton, who is shuttling across the region in truce talks, arrived in Cairo and met with Egyptian President Mohammed Morsi, who is mediating between Israel and Hamas to end the fighting that has killed more than 140 Palestinians and five Israelis.
The blast, which left the bus charred and its windows blown out, was the first bombing in Tel Aviv since 2006. It appeared aimed at sparking Israeli fears of a return to the violence of the Palestinian uprising last decade, which killed more than 1,000 Israelis in bombings and shooting attacks and left more than 5,000 Palestinians dead as well. Hamas has carried dozens of suicide bombings that have killed hundreds of Israelis.
While Hamas did not take responsibility for the attack, it praised the bombing.
‘‘We consider it a natural response to the occupation crimes and the ongoing massacres against civilians in the Gaza Strip,’’ Hamas spokesman Fawzi Barhoum told The Associated Press.
Bassem Ezbidi, a West Bank political analyst, said it was unlikely Hamas itself was behind the attack, since it would not want to risk losing any of the international support it gained in recent days.
‘‘If Hamas wants to target civilians it would do so by firing rockets, but not by buses because such attacks left a negative record in the minds of people. Hamas doesn’t need this now,’’ he said.
On the other hand, Hamas may be interested in signaling to Israel that a renewed bombing campaign is possible, particularly as thousands of Israeli ground troops massed on the Gaza border awaiting a possible invasion should cease-fire talks fail.
A tiny militant group, the Popular Front for the Liberation of Palestine-General Command, claimed responsibility for the bus bombing but offered no evidence to back up the claim. The Damascus-based group has few followers in the West Bank and Palestinian groups often claim attacks they haven’t carried out.
The Tel Aviv bombing came after a night of more than 30 Israeli airstrikes over Gaza that hit government ministries, smuggling tunnels, a banker’s empty villa and a Hamas-linked media office.
Some 10,000 Palestinians sought shelter in 12 UN-run schools, after Israel dropped leaflets urging residents to vacate their homes in some areas of Gaza to avoid being hit by airstrikes, said Adnan Abu Hassna, the UN Relief and Works Agency spokesman.
The influx of displaced people came a day after the head of UNRWA, Filippo Grandi, warned that the agency urgently needed $12 million to continue distributing food to the neediest Gazans. The agency runs schools, shelters and food programs for hundreds of thousands of Palestinian refugees and their descendants in Gaza.
The bus attack took place around noon on one of the coastal city’s busiest arteries, near the Tel Aviv museum, the district courthouse and across from an entrance to Israel’s national defense headquarters.
The blast was from a device placed inside the bus by a man who then got off, said Yitzhak Aharonovich, Israel’s minister of internal security,
He said the explosion took place while the bus was moving. Blood splattered the sidewalk at the site of the explosion, with glass scattered around.
‘‘I was sitting in the middle of the bus. We were about to pull into a station and suddenly there was a huge explosion,’’ said Yehuda Samarano, 59, from his hospital bed where he was being treated for shrapnel wounds to his chest and leg. ‘‘I flew from my seat. Everything became white and my ears are still ringing now.’’
Police set up roadblocks across the city trying to apprehend the attacker.
‘‘We strongly believe that this was a terror attack,’’ said police spokesman Micky Rosenfeld. He said three of the 10 wounded were moderately to seriously hurt.
In Gaza, the bombing was praised from mosque loudspeakers, while Hamas’ television station interviewed people praising the attack as a return of militants’ trademark tactics.
Clinton said the US ‘‘strongly condemns’’ the bombing, which she called a ‘‘terrorist attack.’’
Israel and Hamas had seemed on the brink of a truce deal Tuesday following a swirl of diplomatic activity also involving UN chief Ban Ki-moon and Egypt’s Morsi. But sticking points could not be resolved as talks — and violence — stretched into the night.
Clinton shuttled among the sides, meeting Israeli Prime Minister Benjamin Netanyahu in Jerusalem Tuesday night, then Palestinian President Mahmoud Abbas in the West Bank the next morning before heading to Cairo. After talks withC Clinton, the Egyptian president met with Ban.
In overnight Gaza violence, at least four airstrikes within seconds of each other pulverized a complex of government ministries the size of a city block, rattling nearby buildings and shattering surrounding windows. Another strike leveled the empty, two-story home of a well-known banker in downtown Gaza City.
‘‘This is an injustice carried out by the Israelis,’’ said the house’s caretaker, Mohammed Samara. ‘‘There were no resistance fighters here. We want to live in peace. Our children want to live in peace. We want to live like people in the rest of the world.’’
The Israeli military said its targets included the Ministry of Internal Security, which it says served as one of Hamas’ main command and control centers, a military hideout used as a senior operatives’ meeting place and a communications center.
Huge clouds of black smoke rose above the Gaza City skyline on Wednesday as airstrikes pounded a Gaza City sports stadium, from which rockets have been fired at Israel in the past, and a high-rise office building housing Hamas-affiliated media offices, but also Agence France-Presse.
AFP reporters said they evacuated their fourth-floor office Tuesday, after an initial strike targeted sixth-floor offices linked to Hamas and other smaller factions.
A four-year-old boy was killed in the second attack on the high-rise Wednesday, according to Gaza health official Ashraf al-Kidra. The boy, Abdel-Rahman Naim, was in his family apartment in the building when he was struck by shrapnel and died on the way to Gaza’s Shifa Hospital, al-Kidra said.
The attacks brought to 144 the number of Palestinians killed since Israel launched its offensive on Nov. 14. Among the dead were 60 civilians, according to al-Kidra.
Five Israelis have also been killed by Palestinian rocket fire, which continued unabated early Wednesday with dozens of rockets.
Israel launched the offensive Nov. 14 following months of rocket salvoes from Gaza. It has battered the territory with more than 1,500 airstrikes. The militants hit back with more than 1,400 rocket attacks. The Israeli death toll has been relatively low because of a US-funded rocket defense system that has shot down hundreds of Gaza projectiles.
Washington blames Hamas rocket fire for the outbreak of violence and has backed Israel’s right to defend itself, but has cautioned that an Israeli ground invasion could send casualties soaring.
The US considers Hamas, which has killed hundreds of Israelis in suicide and other attacks, to be a terror group and does not meet with its officials.
Israeli media quoted Defense Minister Ehud Barak as telling a closed meeting that Israel wanted a truce to start with a 24-hour test period of no rocket fire to see if Hamas could enforce a truce among its forces and other Gaza militant groups.
Palestinian officials briefed on the negotiations said Hamas wanted assurances of a comprehensive deal that included new arrangements for prying open Gaza’s heavily restricted borders — and were resisting Israeli proposals for a phased agreement. Israel and Egypt slammed shut the border after the militant group seized the territory from Abbas in June 2007, hoping to disrupt Hamas rule.
The officials spoke on condition of anonymity because they were not authorized to talk to the media.