U.S. President Joe Biden spoke with the leaders of Israel and Lebanon on Tuesday to congratulate them over what the United States sees as a historic breakthrough over the two countries’ maritime border.

“After months of mediation by the United States, the governments of Israel and Lebanon have agreed to formally end their maritime boundary dispute and establish a permanent maritime boundary between them,” Biden said in a statement after speaking to Israeli Prime Minister Yair Lapid and Lebanon President Michel Aoud.

Briefing reporters, a senior Biden administration official said the agreement would provide Lebanon with fresh potential for foreign direct investment, particularly in the energy sector.

Israel will be compensated for any share of hydrocarbons found on its side of the Mediterranean border, the official said.

In addition, Israel will maintain “its security mechanisms and infrastructure that they need to make sure their shoreline is protected,” the official said.

The official, speaking on condition of anonymity, said the deal was not easy to negotiate and there may be difficult moments ahead. The official said the United States would continue to play a mediating role as needed.

“This is not a direct bilateral agreement. It is through the United States, but it is a marking of boundary that will allow both countries to pursue their economic interests without conflict. That is the goal,” the official said.