JERUSALEM (AP) — Israel’s prime minister said Tuesday that the country has reached a “historic agreement” with neighboring Lebanon over their shared maritime border after months of U.S.-brokered negotiations.

The agreement would mark a major breakthrough in relations with the two countries, which formally have been at war since Israel’s establishment in 1948. But the deal still faces some obstacles, including key legal and political challenges in Israel. There was no immediate confirmation by Lebanon that a deal had been reached.

At stake are rights over exploiting undersea natural gas reserves in areas of the eastern Mediterranean that the two countries — which do not have diplomatic relations — claim.

Premier Yair Lapid called the deal an “historic achievement that will strengthen Israel’s security, inject billions into Israel’s economy, and ensure the stability of our northern border.”

The agreement is expected to enable additional natural gas production in the Mediterranean. Lebanon hopes gas exploration will help lift its country out of its spiraling economic crisis.

Lebanon and Israel both claim some 860 square kilometers (330 square miles) of the Mediterranean Sea. Under the agreement, those waters would be divided along a line straddling a strategic natural gas field.

According to a senior Israeli official, Lebanon would be allowed to produce gas from that field, called “Qana,” but pay royalties to Israel for any gas produced from the Israeli side. Lebanon has been working with the French energy giant Total on preparations for exploring the field.

The agreement would also leave in place an existing “buoy line” that serves as a de facto border between the two countries, the official said. He spoke on condition of anonymity because he was discussing behind-the-scenes negotiations.

Many leading security figures, both active and retired, have hailed the deal because it could lower tensions with Lebanon’s Hezbollah militant group, which has repeatedly threatened to strike Israeli natural gas assets in the Mediterranean. With Lebanon now having a stake in the region’s natural gas industry, experts believe the sides will think twice before opening up another war.

The two sides fought a monthlong war in 2006, and Israel considers the heavily armed Hezbollah to be its most immediate military threat.

“It might help create and strengthen the mutual deterrence between Israel and Hezbollah,” said Yoel Guzansky, a senior fellow at Israel’s Institute for National Security Studies. “This is a very positive thing for Israel.”

An Israeli official said the deal would go before Israel’s Security Cabinet and then the full Cabinet on Wednesday and be presented to Parliament for a 14-day review. After the review, the Cabinet would reconvene to give final, formal approval, the official said, speaking on condition of anonymity to discuss government policy.

The process will take place less than three weeks before Israel goes to the polls Nov. 1 for the fifth time in under four years.

Approval is not guaranteed. Former Prime Minister Benjamin Netanyahu, has claimed Lapid does not have the authority to sign an agreement and vowed to cancel what he calls a “disgraceful deal” if re-elected.

The Kohelet Policy Forum, an influential conservative think tank, already has filed a challenge to the Supreme Court trying to block the deal.

Eugene Kontorovich, the forum’s director of international law, claimed the agreement requires parliamentary approval. He accused the government of trying to rush through an agreement under pressure from Hezbollah. “This means Hezbollah now overrides Israel’s democracy,” he said.

Senior U.S. energy envoy Amos Hochstein, whom Washington appointed a year ago to mediate talks, delivered a modified proposal of the maritime border deal to lead Lebanese negotiator, Deputy Speaker Elias Bou Saab late Monday night, according to local media and officials.

President Michel Aoun’s office said the latest version of the proposal “satisfies Lebanon, meets its demands, and preserves its rights to its natural resources,” and will hold consultations with officials before making an announcement.