WASHINGTON — U.S. President Donald Trump said on Saturday he had spoken with Israeli Prime Minister Benjamin Netanyahu about a possible mutual defense treaty between the two nations, a move that could bolster Netanyahu's re-election bid just days before Israelis go to the polls.

"I had a call today with Prime Minister Netanyahu to discuss the possibility of moving forward with a Mutual Defense Treaty, between the United States and Israel, that would further anchor the tremendous alliance between our two countries," Trump said on Twitter.

He added that he looked forward to continuing those discussions later this month on the sidelines of the United Nations General Assembly session in New York.

Netanyahu thanked Trump, saying in a tweet that Israel "has never had a greater friend in the White House," and adding that he looked forward to meeting at the U.N. "to advance a historic Defense Treaty between the United States and Israel."

The timing of Trump's tweet, just days before Israel's election on Tuesday, appeared aimed at buttressing Netanyahu's bid to remain in power by showcasing his close ties to Trump.

Opinion polls predict a close race, five months after an inconclusive election in which Netanyahu declared himself the winner but failed to put together a coalition government.

Netanyahu's Likud party is running neck-and-neck with the centrist Blue and White party led by former armed forces chief Benny Gantz, who has focused heavily on looming corruption charges Netanyahu faces.

In a televised interview with Israel's Channel 12 later on Saturday, Netanyahu made a direct appeal to voters based on the treaty. "I'm going to get us a defense pact that will provide us with security for centuries but for that I need your votes," he said.

Trump previously bolstered Netanyahu's candidacy when he recognized Israel's claim of sovereignty over the Golan Heights ahead of the elections earlier this year.

Some Israeli officials have promoted the idea of building on Netanyahu's strong ties to the Trump administration by forging a new defense treaty with the United States, focused especially on guarantees of assistance in any conflict with Iran.

Trump provided no details, but a mutual defense treaty could obligate the United States to come to Israel's defense if it is attacked.

Israeli Foreign Minister Israel Katz said earlier this month that a pact should apply to "defined issues – nuclear threats and the matter of long-range missiles aimed by Iran at Israel."

"We have means of offense and defense, but this would spare us the need to earmark enormous resources on a permanent basis and for the long-term in the face of such threats," Katz told Israel's Ynet TV.

Netanyahu's chief rival Gantz assailed the idea as a "grave mistake", arguing it would strip Israel of military autonomy.

"This is not what we want," the centrist candidate told a conference in Jerusalem. "We have never asked anyone to get killed for us. We have never asked anyone to fight for us. And we have never asked anyone anyone's permission to defend the State of Israel."