GAZA CITY, Gaza Strip — The Palestinian prime minister traveled Monday to the Gaza Strip to launch an ambitious reconciliation effort with the rival Hamas militant group, receiving a hero’s welcome from thousands of people as the sides moved to end a bitter 10-year rift.

Prime Minister Rami Hamdallah, representing Palestinian President Mahmoud Abbas’ Fatah party, was joined by dozens of top officials, aides and security men on the trip from the West Bank through Israel and into Gaza to meet with the Hamas officials. It is by far the most ambitious attempt at reconciliation since Hamas seized power of the coastal strip in 2007.

The sides exchanged smiles, handshakes and pleasantries — a reflection of the changed climate that has ripened conditions for reconciliation after other failed attempts. But difficult negotiations lie ahead, and key sticking points, particularly who will control Hamas’ vast weapons arsenal, could easily derail the effort.

On Monday, at least, the two sides put aside their differences.

Well-wishers surrounded Hamdallah’s car as it entered Gaza through the Israeli-controlled Erez border crossing, and dozens of Palestinian youths gathered alongside a barbed-wire fence to glimpse the welcoming ceremony. Some waved Palestinian or yellow Fatah flags, and many chanted Hamdallah’s name.

“The only way to statehood is through unity,” Hamdallah told the crowd of about 2,000. “We are coming to Gaza again to deepen the reconciliation and end the split.”

Conditions in Gaza have deteriorated greatly in a decade of Hamas rule, and the feeling of hope by desperate residents was palpable Monday.

Thousands lined the streets to watch Hamdallah’s 30-vehicle convoy. The crowd forced the delegation to delay its first meeting at the home of the top Fatah official in Gaza and instead take a break at a beachside hotel.

Dozens of vehicles later returned to the Shejayeh neighborhood for the lunch. Hamas’ top leaders, Ismail Haniyeh and Yehiyeh Sinwar, said next to Hamdallah and West Bank security chief Majed Faraj.

“This is a day of joy,” said Shaima Ahmed, 28, a women’s rights activist who covered her shoulders with a Palestinian kaffiyeh. “Yes it’s difficult and not easy to go forward, but we only have to be optimistic this time.”

Hamas ousted the Fatah-led forces of the internationally recognized Palestinian Authority in the summer of 2007, leaving the Palestinians torn between rival governments on opposite sides of Israel. Hamas has ruled Gaza, while Abbas’ party has controlled autonomous enclaves in the Israeli-occupied West Bank.

Abbas seeks both territories, along with east Jerusalem, for a Palestinian state, and the division is a major obstacle to any possible peace deal. Israel captured all three areas in the 1967 Mideast war, although it withdrew from Gaza in 2005.

While previous reconciliation attempts have failed, years of international isolation and steadily worsening conditions in Gaza have pushed Hamas toward compromise.

In a significant concession, Hamas has offered to turn over all governing responsibilities to Hamdallah. His ministers are expected to begin taking over government ministries Tuesday, with negotiations in Cairo on more difficult issues in the coming weeks.

Hamdallah said the reconstruction of Gaza, which is still recovering from a 2014 war with Israel, would be a priority.

“We realize that the road is still long and hard. We will be faced with obstacles and challenges, but our people are able to rise again from among destruction and suffering,” he said.

Several factors appear to be working in favor of reconciliation.

Under Hamas’ watch, Gaza has fallen deeper into poverty, battered by a joint Israeli-Egyptian blockade and three devastating wars with Israel. Unemployment is estimated at over 40 percent, Gaza’s 2 million residents are virtually barred from traveling abroad, and residents have electricity for only a few hours a day.

Sinwar, Hamas’ newly elected leader, has expressed willingness to yield most power to Abbas, preferring to return to his group’s roots as an armed “resistance” movement battling Israel.

The group’s leadership is based entirely in Gaza, meaning they no longer have to consult with exiled leaders spread across the Arab world to make difficult decisions.

And perhaps most critically, Hamas has improved relations with Egyptian President Abdel-Fattah el-Sissi. The former general took office after the military ousted then-President Mohammed Morsi in 2013.

Morsi, a member of the Muslim Brotherhood, had close ties with Hamas, and el-Sissi has previously accused Hamas of cooperating with Islamic extremists in Egypt’s neighboring Sinai peninsula. But the sides have grown closer in recent months, with Hamas now providing security cooperation with Egypt and el-Sissi promising to ease the blockade.

Reflecting these improved ties, Egyptian envoys attended Monday’s ceremony, and posters of the Egyptian flag and el-Sissi were hoisted at major intersections.

Egypt also maintains good ties with Israel and could potentially play an important role in selling a reconciliation deal to Israel, which considers Hamas a terrorist group.

Abbas also has much to gain. The 82-year-old Palestinian leader has said the rift with Gaza is his greatest regret. Regaining control of Gaza would help him burnish his legacy, especially after years of failure in peace efforts with Israel.

Still, many obstacles lie ahead. While Hamas is eager to give up its governing responsibilities, officials say the group will not give up its arsenal of thousands of rockets and mortars aimed at Israel.

Officials close to Abbas say he will not agree to allow Hamas to become like Hezbollah, the Lebanese militant group that dominates its country’s politics. The sides will have to find a formula that not only is acceptable to them but which Israel would be willing to tolerate.

Israel has demanded that Hamas renounce violence and recognize its right to exist as part of any reconciliation deal.

It also remains unclear what will happen to Hamas’ 40,000 civil servants, who were hired after Abbas forced his employees in Gaza to resign after the Hamas takeover. In an area with few jobs, both sides will likely want their loyalists to receive salaries.

Fatah spokesman Osama Qawasmi said the sides are up to the task.

“We believe these issues are difficult, but with our will and patience, we can resolve them,” he said.

In signs of good spirits, a family named their child born in Gaza Monday after the visiting Palestinian prime minister, and the official TV station of Abbas’ government broadcast its main news bulletin from Gaza for the first time in a decade since the Hamas takeover.

Donald Trump’s Mideast envoy Jason Greenblatt said in a statement the U.S. “welcomes efforts to create the conditions for the Palestinian Authority to fully assume its responsibilities in Gaza.” It added that “any Palestinian government must unambiguously and explicitly commit to nonviolence, recognition of the state of Israel,” and should also accept previous agreements between the parties.

There was no immediate comment from Israeli Prime Minister Benjamin Netanyahu.