(CNN) — President Barack Obama arrived in Jordan on Friday after scoring a diplomatic coup just before leaving Israel when Prime Minister Benjamin Netanyahu phoned his Turkish counterpart to apologize for an Israeli commando raid in 2010 that killed eight Turks and an American of Turkish origin in a Gaza-bound flotilla.
The apology, long sought by Turkish Prime Minister Recep Erdogan, brought a restoration of normal relations between Turkey and Israel, two vital U.S. allies in the Middle East, according to a statement from Netanyahu's office.
It happened in the phone call during a final meeting between Obama and Netanyahu at Ben Gurion International Airport in Tel Aviv minutes before Air Force One departed for Jordan.
The Israeli government statement said the apology included an offer of compensation.
Obama, who U.S. officials said also took part in the call at one point, issued a statement that welcomed the development.
"The United States deeply values our close partnerships with both Turkey and Israel, and we attach great importance to the restoration of positive relations between them in order to advance regional peace and security," Obama's statement said. "I am hopeful that today's exchange between the two leaders will enable them to engage in deeper cooperation on this and a range of other challenges and opportunities."
The last-minute diplomacy added a flourish to Obama's first foreign trip of his second term, which also was his first visit to Israel as president.
While the two nations have a key strategic partnership, with the United States supplying military aid and diplomatic support as Israel's most vital ally, Obama and Netanyahu had famously frosty relations during the president's first term.
With both beginning new terms after Obama's re-election last year and Netanyahu's recent formation of a new government, the president's visit this week was an opportunity to reset the relationship and signal unified positions on major issues such as the Middle East peace process and Iran's efforts to develop a nuclear weapon.
Obama and Netanyahu met several times during the president's three days in Israel, which also included a state dinner where Israeli President Shimon Peres awarded him the country's highest civilian honor.
Before leaving Israel, Obama paid tribute to the father of modern Zionism in a symbolic visit to Theodor Herzl's grave.
Joined by Peres, Netanyahu and U.S. Secretary of State John Kerry, Obama also visited the grave of former Prime Minister Yitzhak Rabin, who was assassinated in 1995.
Both stops were intended to bolster Obama's standing with Israelis by demonstrating his understanding of the history of the Jewish state.
Obama placed a stone at each grave from the grounds of the Martin Luther King Jr. memorial in Washington in a gesture to link the African-American struggle for freedom with the struggle by the Israeli people for a homeland.
The president also visited the Holocaust memorial Yad Vashem, where he turned up the "eternal flame" of remembrance of the millions of Jewish victims of Nazi death camps in World War II.
Obama called for the world to follow the example of nations that intervened in Nazi genocide.
"Here, alongside man's capacity for evil, we are also reminded of man's capacity for good," he said. "The rescuers, the righteous among nations, who refused to be bystanders, and in their noble acts of courage, we see how this place, this accounting of horror, is in the end a source of hope."
In another cultural stop Friday, Obama also visited the Church of the Nativity in Bethlehem, which is on the West Bank, with Palestinian President Mahmoud Abbas.
After putting himself in the middle of the historic tensions between Israelis and Palestinians this week, Obama then headed to Jordan, a military and intelligence partner that has been facing trying times.
Jordan's leader under duress
Jordan's King Abdullah II has a reputation for benevolence, unlike autocratic rulers such as Syria's Bashar al-Assad or deposed Iraqi dictator Saddam Hussein. One house of the Jordanian parliament is democratically elected.
However, a bad economy and allegations of corruption by public officials have stoked dissatisfaction with Abdullah.
In addition, the country wedged between the Palestinian territories, Iraq and Syria has seen more than its share of refugees from them all. Jordan currently shelters more Syrian refugees than any other country -- more than 300,000, according to the United Nations.
In November, crowds took to the streets calling for Abdullah's downfall because of rising gasoline prices.
More recently, comments attributed to Abdullah in the The Atlantic caused further anger toward the king, who was quoted as calling the opposition Muslim Brotherhood a "Masonic cult" and referring to tribal elders in his country as "old dinosaurs."
The royal palace denied that Abdullah made the comments.
Young Israelis applaud Obama
In Israel, Obama tried Thursday to invigorate the stalled Middle East peace process, urging young Israelis to pressure their leaders to seek peace with Palestinians while acknowledging the Jewish state's historical right to exist and defend itself from continuing threats.
In a speech in Jerusalem that Obama had said would lay out his vision for the region, the president urged Israelis to look at the world through the eyes of Palestinians but also said enemies of Israel must change their rhetoric and tactics to reflect modern reality.
"You are not alone," Obama said in both English and Hebrew, prompting a standing ovation when he declared that "those who adhere to the ideology of rejecting Israel's right to exist might as well reject the earth beneath them and the sky above, because Israel is not going anywhere."
When Obama mentioned the name of Abbas in his speech, some boos erupted in the Jerusalem Convention Center among the audience of mostly young Israelis. He also was interrupted at one point by a protester's shouts, causing the president to joke that the heckling "made me feel at home," in reference to the caustic political climate in Washington.
He urged Israelis to empathize with the plight of Palestinians, using direct and harsh imagery to make his point, and he drew applause when he criticized the Israeli government's controversial policy of building new settlements in disputed territories.
Symbols and gestures
Hours before the speech on the second day of his Middle East swing, two rockets fired from Palestinian-controlled Gaza landed in southern Israel.
They caused no injuries or major damage, but served as a symbolic welcome to Obama's visit to the West Bank later in the day.
In another symbolic moment, Obama received the Presidential Medal of Distinction on Thursday night from Peres at the state dinner that emphasized the close ties between their countries.
In what Netanyahu called a key development of Obama's visit, the leaders announced new talks on extending U.S. military assistance to Israel for another 10 years past the current agreement, which expires in 2017.
During his earlier visit to Ramallah in the West Bank, Obama stressed the need for direct talks between Israelis and Palestinians for a two-state solution.
"The Palestinian people deserve an end to occupation and the daily indignities that come with it," he said at a news conference with Abbas, adding that Palestinians deserve "a future of hope" and a "state of their own."
The core issues right now, Obama said, are achieving sovereignty for Palestinians and security for Israel.
Abbas, however, said the Israeli settlements are "more than a hurdle to peace," calling them illegal and saying it was Israel's duty to stop building them.
He envisioned a Palestinian state based on 1967 borders with Jerusalem as capital -- a scenario unacceptable to Israel.
CNN's John King and Jessica Yellin reported from Israel, and CNN's Ben Brumfield contributed to this report written by Tom Cohen in Washington.