On a surprise visit to Turkey Saturday, Hamas leader Khaled Mashaal hailed the country’s leaders and said he hoped to “liberate Palestine and Jerusalem” with them.

During a speech to officials and supporters of the ruling Justice and Development Party, or AKP, Mashaal congratulated the people of Turkey “for having [Prime Minister Ahmet] Davutoğlu and President Recep Tayyip Erdoğan” as heads of state, adding that “a strong Turkey means a strong Palestine … Inshallah, God is with us and with you on the road to victory.”

“Inshallah we will liberate Palestine and Jerusalem again in the future,” Mashaal said.

Get The Times of Israel's Daily Edition by email and never miss our top stories Free Sign Up

The Hamas leader was introduced to the crowd gathered in the conservative Konya Province in central Anatolia for the annual event by Davutoglu himself. His speech was frequently interrupted by supporters shouting “down with Israel!” and “God is great!”

“A democratic, stable and developed Turkey is a source of power for all Muslims,” Mashaal went on, adding “I greet all the brave people who claim Jerusalem … Our flag is the symbol of all the oppressed in the world.”

Mashaal often shows up at the ruling party’s events. He also attended the AKP’s congress in 2012 when President Erdogan was serving as prime minister. The Hamas leader is set to meet with the president later Saturday.

Davutoglu, in his speech Saturday, said Turkey’s red flag featuring a crescent with a star was a “symbol of the innocent in the world.”

“God is witness … we will make this red flag a symbol of the innocent. This red flag will fly side by side with the flags of Palestine, free Syria and all other innocents’ flags anywhere in the world,” he told the congress.

Turkey and Hamas have seen a rapid rapprochement as Israel’s ties with Ankara continued to deteriorate. The AK Party has had close ties with Hamas since its rise in 2001, led by Davutoglu and Erdogan. The two have been known for their frequent outbursts against Israel over the years.

In August during Israel’s Operation Protective Edge, Erdogan accused Israel of being “more barbaric than Hitler.” Israel launched the campaign on July 8 to stop rocket fire from Gaza and destroy tunnels dug under the border by Hamas for attack purposes.

Jerusalem has also accused Turkey of allowing Hamas to operate on its soil, a charge Ankara strongly denies.

Last month, Israel appealed to the NATO coalition — of which Turkey is a member – and to the US leadership to take steps against Ankara for enabling Hamas terrorists to operate and plan terror attacks against Israelis from its territory.

Israel has alleged on several recent occasions that Hamas cells operating in the West Bank and planning major terror attacks were doing so under the guidance and leadership of Hamas’s Saleh al-Arouri, who was deported from the West Bank to Turkey in 2010, while Ankara turns a blind eye to his actions.

Last month, the Shin Bet security service said members of a Hamas terror ring in the West Bank, run from the organization’s headquarters in Turkey, sought to carry out an array of major attacks, including on Jerusalem’s main soccer stadium and its light rail line.

Arouri, they said, built up and funded the network, and has effectively established a Hamas command post in Turkey which is leading terror efforts in the West Bank. Arouri is reportedly aided by dozens of operatives, some of whom were deported by Israel in the wake of the Gilad Shalit prisoner deal in 2011.

The officials accused Turkey as well as Qatar — the current home of Hamas leader Khaled Mashaal — of enabling Hamas to operate freely within their territories to carry out attacks against Israel and undermine the Palestinian Authority.

In October, Defense Minister Moshe Ya’alon said Hamas had two command centers: one in the Gaza Strip, which has been ruled by the Islamist group since 2007, and one in Turkey.

Israel’s ties with Turkey became strained after Israel’s Operation Cast Lead in Gaza in 2008-2009, but nosedived in May 2010 when the Mavi Marmara ferry was boarded by Israeli commandos as it attempted to break the naval blockade of the Gaza Strip. In the ensuing melee, after the Israeli soldiers were attacked with iron bars and wooden bats, troops opened fire and nine Turkish activists were killed; 10 Israeli soldiers were injured.

AFP and Times of Israel staff contributed to this report.