By deviating from his original schedule and praying at the security barrier in Bethlehem Sunday, Pope Francis handed an initial propaganda victory to the Palestinians. On Monday morning, as he again veered from his program and prayed at a memorial for Israeli victims of Arab terror, he somewhat rectified, from Jerusalem’s perspective, the damage he had caused.

By agreeing twice to stray from his itinerary and stop at these highly symbolic venues, Francis stepped directly into the political morass of the Middle East conflict, although he had repeatedly vowed that his trip to the Holy Land would focus on religious matters and steer clear of gestures that either side could interpret as an endorsement of their respective narratives.

According to Israel’s version of the events, the pontiff’s impromptu stop at the security barrier in the Bethlehem area on Sunday was not a spontaneous decision of his own, but was long planned by the Palestinian officials accompanying him. Nothing about it was random, Israeli officials said, adding that the Palestinians deliberately took him to a very specific part of the wall in a bid to embarrass the Israeli government.

“The pope’s unplanned stop in Bethlehem was totally out of context. There were no explanations,” said Lior Haiat, an Israeli diplomat in charge of media coverage for the visit. “It was hard for us from a hasbara perspective,” he said, using a Hebrew term referring to efforts to better explain government policy.

As the Palestinians rejoiced over the pope’s visit at what they call the “apartheid wall” — the controversial a-word was written on the section of the wall where the papal motorcade stopped, well visible to the holy father — the Israeli government’s media professionals powwowed about a proper response, looking for ways to counterbalance the highly symbolic gesture that turned that phase of the visit into a PR victory for the Palestinians.

After some brainstorming, it was Rami Hatan, the director of the Foreign Ministry’s World Religions department, who came up with the idea: Ask the pope to visit the memorial for victims of terrorism at the Mount Herzl cemetery, to show him and the entire world why Israel built the barrier in Bethlehem?

“The Vatican officials explained to us that the pope didn’t pray against the security barrier, but he prayed against the situation that forces such a wall to be built,” Haiat said. “Therefore, we thought we needed to show him why we built the wall. It’s obvious that the barrier is a result of something, it is not the reason.”

After Prime Minister Benjamin Netanyahu approved the idea, the Foreign Ministry staff approached the Vatican official in charge of protocol, who immediately agreed.

Pope Francis stands at Israel's West Bank security barrier on his way to a mass in Manger Square in Bethlehem on Sunday, May 25, 2014. (photo credit: AP Photo/Ariel Schalit)

Pope Francis stands at Israel’s West Bank security barrier on his way to a mass in Manger Square in Bethlehem on Sunday, May 25, 2014. (photo credit: AP Photo/Ariel Schalit)

At the Mount Herzl memorial, which was inaugurated in 1998 and contains 78 tablets to commemorate victims of terror attacks since 1851, Netanyahu told the pope “that the security fence prevented many more victims that Palestinian terror, which continues today, planned to harm,” according to a statement released by his office.

Eyewitnesses said the pope was “very moved” as he looked at the memorial, and that Netanyahu spoke to him about how the number of deadly Palestinian terror attacks has been drastically reduced thanks to the security barrier. Netanyahu also mentioned the 1994 bombing at the AMIA Jewish community center in the pope’s hometown of Buenos Aires, which killed 85 people.

“We don’t teach out children to plant bombs. We teach them peace,” Netanyahu told the pope at the site of the memorial, after telling him of his son’s friend, who was killed by a suicide attack. “But we have to build a wall against those who teach the other side. Still, it cannot prevent the incitement to hate and terror and the destruction of Israel that permeates so much of society on the other side of the fence. If that changes, then the walls could come down and we will have peace.”

“Terror is absolute evil. It emanates from evil and engenders evil,” Pope Francis said at the memorial, according to Foreign Ministry spokesman Yigal Palmor. “Never again!”

Later in the day, at a meeting in Jerusalem’s Notre Dame Center, Netanyahu again brought up the security barrier, saying it has protected “thousands of lives.” Since it was erected, he said, “terror has stopped.”

While the pope’s every word and every move will be scrutinized by Mideast pundits for days to come, trying to figure out whether he was more sympathetic to the Palestinians or to the Israelis, some took the whole episode with a degree of humor. Israeli journalist Chaim Levinson tweeted on Monday afternoon that, as the holy father moved from venue to venue at a dizzying pace, someone should whisper in his ear “that he [does] not need to pray at every wall in the Middle East.”