JERUSALEM — Israel has offered aid and support to Lebanon following Tuesday's devastating port explosion in Beirut, a quick turn of sentiment after a recent exchange of attacks with Lebanese militants along a tense border in recent days.

Prime Minister Benjamin Netanyahu said Israel was ready to provide medical and humanitarian assistance for a catastrophe that some initially suspected was caused by an Israeli strike. Israel has denied any role in the blast, and the investigation has focused on the unsafe storage of ammonium nitrate in a waterfront warehouse.

With at least 135 killed and thousands injured, Israeli officials said it was time to put aside hostilities and offer help to Israel’s northern neighbor.

“We have no fight with either the Lebanese people or the Iranian people, but with their governments,” Netanyahu said Wednesday in an appearance before Israel’s parliament.

“This is the time to transcend conflict,” a spokesman for the Israeli military tweeted in Arabic. In Tel Aviv, Mayor Ron Huldai had the city hall lighted in the form of the Lebanese cedar flag Wednesday.

“Humanity takes precedence over every conflict, and our heart is with the Lebanese people in the aftermath of the terrible disaster that they’ve suffered,” Huldai tweeted.

Israeli citizens offered support on social media, including taped messages compiled and tweeted by the Ministry of Foreign Affairs. “We stand with you from the mountains of the Upper Galilee,” said one woman.

Investigators said a stockpile of more than 2,500 tons of ammonium nitrate has been identified as the immediate cause of the blast that devastated a port area of the city. The volatile material, a component of fertilizer that is also often used to make bombs, had been stored in a warehouse since being seized by customs authorities six years ago, despite repeated warnings from port officials that it posed a risk.

Hospitals in Haifa and northern Israel were ready to provide assistance to Lebanon, but it was unclear how personnel or medical supplies could be transported over the closed and militarized border.

One team of doctors and nurses from the Sheba Medical Center offered to deploy to Cyprus, where a number of the casualties from the blast are being treated, according to media reports.

The military and diplomatic tensions between Israel and Lebanon would complicate the delivery of any potential aid, and officials said they were relying on international channels and third countries to make the offer.

The prime minister’s office said it has asked the United Nations’ special coordinator for the region, Nickolay Mladenov, to convey its offer of assistance. A diplomat familiar with the communications said, “We have forwarded the offer but cannot comment on anything else.”

Defense Minister Benny Gantz and Foreign Minister Gabi Ashkenazi said they have asked France and U.N. mediators operating along the border to carry offers of assistance. French President Emmanuel Macron visited Beirut on Thursday.

The friendly overtures mark a stark turnaround from recent bellicose rhetoric and armed skirmishes between Israel and Hezbollah, which is both an armed militant group and a political party in Lebanon.

Tensions have soared in recent weeks, with the Israeli army repelling what it characterized as an armed incursion last week across the U.N.-monitored “Blue Line” separating Israel, Lebanon and Syria. The incidents, which included heavy shelling and a warning to Israeli citizens in the area to stay in their houses, followed an airstrike in Syria attributed to Israel that killed a Hezbollah fighter.

With hostilities at a boiling point, not all Israelis were comfortable with the offers of assistance to Lebanon. Israel views Hezbollah as a dangerous tool of Iran, and Netanyahu warned the Lebanese government this week that the group was getting it “mixed up in trouble.” Israel and Hezbollah fought a war in 2006.

“Lebanon is formally an enemy country,” Yair Netanyahu, the prime minister’s son, tweeted in response to the appearance of the Lebanese colors on the Tel Aviv municipal building. “By law, it is a criminal offense to fly an enemy flag.”

Others said the impulse to provide aid was misguided, given Lebanon’s failure to contain Hezbollah.

“If anyone thinks that if we set aside our differences for a moment that we’re going to get any points for our kindheartedness . . . they are terribly wrong,” commentator Noam Amir wrote in the Makor Rishon newspaper. “Sometimes, even in the face of the most heartbreaking developments, we simply need not to get involved.”