In a dramatic reconciliation urged and brokered by President Barack Obama shortly before he left Israel on Friday, Prime Minister Benjamin Netanyahu and his Turkish counterpart Recep Tayyip Erdogan spoke by telephone and agreed to end three years of frozen relations.

In the call, Netanyahu apologized to the Turkish people “for any errors that could have led to loss of life” in the May 2010 Mavi Marmara incident, “and agreed to complete the agreement on compensation,” his office later said in a statement. Erdogan reportedly said he accepted the Israeli apology.

In the first conversation between the leaders since 2009, Netanyahu made it clear that the tragic consequences of the Mavi Marmara flotilla interception — in which nine Turkish citizens were killed by Israeli naval commandos who had come under attack as they sought to commandeer the Gaza-bound vessel — were unintentional.

The leaders agreed to return their respective ambassadors and pledged to overcome differences.

Erdogan also “withdrew” recent comments calling Zionism a crime against humanity, though he did not apologize for them, an informed source said.

US President Barack Obama, right, talks with Prime Minister Benjamin Netanyahu at a state dinner in his honor on Thursday, at the President’s Residence in Jerusalem. (photo credit: Avi Ohayon/Flash90)

“Prime Minister Benjamin Netanyahu spoke today with Turkish Prime Minister Recep Tayyip Erdogan. The two men agreed to restore normalization between Israel and Turkey, including the dispatch of ambassadors and the cancellation of legal steps against IDF soldiers,” Netanyahu’s office said in the statement.

Netanyahu told Erdogan that he had “good talks” with Obama “on the issue of regional cooperation and the importance of Israeli-Turkish relations. The prime minister expressed regret over the deterioration in bilateral relations [with Turkey] and noted his commitment to working out the disagreements in order to advance peace and regional stability,” the statement added.

“The prime minister made it clear that the tragic results regarding the Mavi Marmara were unintentional and that Israel expresses regret over injuries and loss of life. In light of the Israeli investigation into the incident, which pointed out several operational errors, Prime Minister Netanyahu apologized to the Turkish people for any errors that could have led to loss of life and agreed to complete the agreement on compensation,” the statement continued.

Netanyahu “also noted that Israel has already lifted several restrictions on the movement of civilians and goods to all of the Palestinian territories, including Gaza, and added that this will continue as long as the quiet is maintained. The two leaders agreed to continue to work on improving the humanitarian situation in the Palestinian territories,” the statement concluded.

Turkey and Israel were once close allies, but relations unraveled in recent years, exacerbated in 2010 by the Israeli interception of the Mavi Marmara as it sought to break Israel’s blockade of the Gaza Strip. Turkey had conditioned warmer ties on an Israeli apology and compensation.

The reconciliation took place shortly before Obama completed his three-day visit to Israel, in a call from Ben-Gurion Airport. Initially Obama spoke to Erdogan, reports said, and then he handed the phone to Netanyahu. The US had indicated for some time that it saw an imperative for Israel and Turkey to heal the rift between them, especially given the regional challenges posed by Iran’s nuclear drive and the raging civil war in Syria.

Secretary of State John Kerry had laid the groundwork for the call earlier, and Netanyahu had told IDF Chief of the General Staff Benny Gantz and his Cabinet colleagues that the move was imminent.

Erdogan has become an increasingly bitter critic of Israel in recent years, repeatedly denouncing its policies on the Palestinians, and supporting Hamas. At a World Economic Forum meeting in Switzerland in 2009, Erdogan fiercely attacked President Shimon Peres for an Israeli incursion into Gaza which was taking place at the time: “When it comes to killing, you know well how to kill,” Erdogan yelled at him, and stormed off the stage.

In a sign Wednesday that a reconciliation might be near, Erdogan said that his February statement that Zionism is a “crime against humanity” on par with anti-Semitism and fascism was misunderstood.

Erdogan, speaking to a Danish newspaper, said that he knew his statements caused “some debate” but that “no one should misunderstand what I said.” He said “everyone should know” that his comments were directed at “Israeli policies,” especially as regards to “Gaza and the settlements.”

“It’s entirely natural for us to continue to criticize Israel as long as it will not give up its approach of denying the right to exist of the Palestinian state,” Erdogan added. ”In several statements I openly condemned anti-Semitism, and it clearly displays my position on this issue.”

In late February, speaking in Vienna at a United Nations event devoted to dialogue between the West and Islam, Erdogan had decried rising racism in Europe and the fact that many Muslims “who live in countries other than their own” often face harsh discrimination. “We should be striving to better understand the culture and beliefs of others, but instead we see that people act based on prejudice and exclude others and despise them,” Erdogan said, according to a simultaneous translation provided by the UN. “And that is why it is necessary that we must consider — just like Zionism or anti-Semitism or fascism — Islamophobia as a crime against humanity.”

In his statement Friday, Netanyahu said he had seen Erdogan’s “recent interview in a Danish newspaper and expressed his appreciation for the latter’s remarks.”

Erdogan, in Friday’s call, reportedly sought to have Israel lift its blockade of Gaza, which Netanyahu refused. Israel fears Hamas would exploit the lifting of security measures to import weaponry for use against Israel. The two leaders did agree to cooperate on improving the humanitarian situation in Gaza, reports said.

Obama said he welcomed the reconciliation and that it was important the two nations restore good relations so they can cooperate on regional security.

An informed source in Jerusalem, refusing to be named, said later that it had been a “difficult decision” for Netanyahu to apologize. The agreement to resume ties “feels like the birth of a baby,” he said. “Now it’s up to the parents to steer” the way forward.

Former defense minister Ehud Barak reported offered recently to issue an apology, but Netanyahu did not take up his offer. Barak’s successor, new Defense Minister Moshe Ya’alon, is said to have backed Friday’s move. Former foreign minister Avigdor Liberman, by contrast, slammed the move.

“The newly normalized relations will be more beneficial to the Mideast than the current relationship,” the source noted. He said he saw the move as having “a positive impact on regional stability, mostly, but not only in the Syrian context.”