Comments by US President Donald Trump supporting a two-state solution to the Middle East conflict for the first time have turned heads ahead of UN speeches by the Israeli and Palestinian leaders.

Trump’s endorsement of the goal of a Palestinian state, long the focus of US peace efforts before he came into office, was decidedly lukewarm — and he even slightly backtracked from it later in the day.

But it still sparked concern among some Israeli right-wing politicians who hoped Trump would bury the idea of Palestinian statehood once and for all, while Palestinian officials dismissed his comments as empty talk.

When meeting Israeli Prime Minister Benjamin Netanyahu on the sidelines of the UN General Assembly on Wednesday, Trump said he backed a two-state solution since “that’s what I think works best, that’s my feeling.”

Later at a news conference, he said the same, but also reiterated his earlier position.

“If the Israelis and the Palestinians want one state, that’s OK with me,” he said.

“If they want two states, that’s OK with me. I’m happy if they’re happy.”

US President Donald Trump (R) meets with Israeli Prime Minister Benjamin Netanyahu on September 26, 2018 in New York on the sidelines of the UN General Assembly.

Netanyahu and Palestinian president Mahmud Abbas are due to address the UN General Assembly later on Thursday, but they both seem unlikely to be moved by Trump’s comments.

Netanyahu told Israeli journalists after his meeting with Trump that he had not been surprised by his endorsement of two states, which many hoped the Oslo accords of the 1990s could achieve.

Twenty-five years after the first of those accords, that goal seems far out of reach for now. Peace efforts have been at a standstill since a US-led push collapsed in 2014.

Netanyahu reiterated his stance that Israel must retain security control under any deal with the Palestinians.

His position has evolved somewhat since a landmark speech he gave in 2009 in which he spoke specifically about a future demilitarised Palestinian state.

In recent years he has said he wants the Palestinians to govern themselves without specifying whether that means full statehood or some lesser form of autonomy.

“It is important to set what is inadmissible to us: Israel will not relinquish security control west of Jordan,” Netanyahu said on Wednesday, according to Israeli newspaper Haaretz.

“This will not happen so long as I am prime minister and I think the Americans understand that.”

But right-wing members of Netanyahu’s coalition made their opposition to Palestinian statehood loud and clear.

One of his main rivals, Education Minister Naftali Bennett of the far-right Jewish Home, said as long as his party is in government “there will not be a Palestinian state, which would be a disaster for Israel.”

Others issued similar comments, while Regional Cooperation Minister Tzachi Hanegbi, of Netanyahu’s Likud party, told Israel’s army radio that “there will not be a state in the classic sense.”

Palestinian officials were dismissive of Trump’s comments.

Their leadership cut off contact with the White House after Trump recognised Jerusalem as Israel’s capital in December.

Trump has also cut more than $500 million in Palestinian aid.

Palestinian leaders accuse his administration of blatant bias in favour of Israel and of seeking to blackmail them into accepting his terms.

Palestinian foreign minister Riyad al-Maliki told reporters in New York that Abbas’s team met more than 40 times with Trump’s envoys only “to discover that they have opted to open that war against the Palestinians to inflict the most damage.”

Trump’s son-in-law and aide Jared Kushner is part of a team working on what the president has called the “ultimate deal” — Israeli-Palestinian peace.

The president said Wednesday he would present the long-awaited plan by the end of the year.

The team’s efforts have been met with derision from the Palestinians, who note that the Israelis have so far not been asked publicly for any concessions in return for the Jerusalem recognition and other moves they favour.

“Jared, who’s so involved, he loves Israel … But he’s also going to be very fair with the Palestinians,” Trump told the news conference on Wednesday.

In his address on Thursday, Abbas is expected to urge international action to salvage the option of a two-state solution.

Netanyahu’s speech is likely to be focused on Israel’s main enemy Iran, particularly its presence in neighbouring Syria.