SYDNEY (Reuters) - Australian Prime Minister Scott Morrison, whose government faces a crucial by-election in four days, said on Tuesday Canberra was open to recognizing Jerusalem as Israel’s capital, prompting concern from Indonesian and Palestinian officials.

Morrison’s comments about recognizing Jerusalem and possibly moving Australia’s embassy there, just like U.S. President Donald Trump’s controversial decision in December, would reverse decades of foreign policy and inflame tension with some of Australia’s Asian neighbors.

Australia is due to a sign a trade deal this year with

Indonesia, the world’s biggest Muslim-majority country, where the Palestinian question is a sensitive issue and tens of thousands protested against Trump’s decision.

Foreign Minister Retno Marsudi, speaking at a joint news conference with Palestinian Foreign Minister Riyad al-Maliki in Jakarta, reaffirmed Indonesia’s support for a two-state solution to the Middle East dispute and warned Australia against the risk of insecurity.

“Indonesia asks Australia and other countries to support peace talks ... and not take steps that would threaten that peace process and stability of world security,” Marsudi said.

Morrison told parliament on Tuesday he had been in touch with Indonesian President Joko Widodo to explain his position.

Maliki said he was saddened that Australia might violate international law and disrespect a U.N. Security Council resolution.

“They are risking Australia’s trade and business relationship with the rest of the world, in particular (the) Arab and Muslim world,” he said.

Ambassadors from 13 Arab countries met in Canberra on Tuesday and agreed to send a letter to Australia’s foreign minister expressing their concern, Egyptian ambassador to Australia Mohamed Khairat said.

Morrison’s openness to recognizing Jerusalem and moving Australia’s embassy there comes four days before a by-election in Sydney at which his center-right coalition runs the risk of losing its tenuous hold on power.

The by-election is in the Sydney harborside seat of Wentworth vacated by former prime minister Malcolm Turnbull, who was ousted in a party-room coup by members of Morrison’s Liberal party, the senior partner in a Liberal-National coalition, in August.

Census figures show 12.5 percent of people in Wentworth are Jewish, a significantly larger proportion than elsewhere in Australia. The Liberal candidate contesting the by-election on Saturday, Dave Sharma, is a former Australian ambassador to Israel who has floated the idea in the past.

Prime Minister Scott Morrison speaks to the media during a press conference at Parliament House in Canberra, Australia, October 16, 2018. AAP/Mick Tsikas/via REUTERS

Morrison will have to negotiate with independent lawmakers in order to continue governing in a minority if the coalition loses Saturday’s by-election.

‘PRETTY BLATANT’

Morrison said earlier on Tuesday the political orthodoxy that drove such debates suggested that discussion of the Israeli capital was “taboo”. He said no decision had been made and he was simply being open to the suggestion.

The Sydney Morning Herald newspaper described his apparent change of heart as “unprincipled and craven”.

University of Sydney political analyst Rod Tiffen said the shift in position was being driven by domestic politics.

“It’s a big change, it is out of step with everyone, except America,” said Tiffen.

“But three days out from the Wentworth by-election, it’s pretty blatant ... to the extent that there is a Jewish vote there, it probably helps.”

The status of Jerusalem is one of the thorniest obstacles to a peace deal between Israel and the Palestinians. Israel regards all of the city, including the eastern sector that it annexed after the 1967 Middle East war, as its capital.

Trump’s decision in December enraged Palestinians and upset the Arab world and Western allies. Australia refused to follow its closest ally’s example and has so far kept its mission in Tel Aviv.

The apparent change of policy was welcomed by Israel but swiftly criticized by Palestinian representatives.

Israel’s Prime Minister Benjamin Netanyahu, whom Morrison had telephoned to explain his shift, said on Twitter he was “very thankful” Morrison was considering the move.

Palestinians, with broad international backing, want East Jerusalem as the capital of a future state they hope to establish in the occupied West Bank and the Gaza Strip. Peace talks between the parties broke down in 2014.

The U.S. Embassy became the only foreign embassy in Jerusalem in May, but Netanyahu has attempted to persuade others to follow suit.