President Trump is exploring an expanded military alliance with Israel — days ahead of a crucial re-election bid for Prime Minister Benjamin Netanyahu.

Trump announced the possible pact in a pair of tweets just three days before Israel’s national elections, set for Tuesday.

A mutual defense agreement “would further anchor the tremendous alliance between our two countries,” Trump posted.

“I look forward to continuing those discussions after the Israeli Elections when we meet at the United Nations later this month!”

Under a mutual defense framework, allies agree to join each other’s military efforts when one side comes under attack. The U.S. maintains several such agreements — with the members of NATO and with Japan, for example — but has no such formal treaty with Israel.

Polls point toward a dead heat between Netanyahu’s Likud party and the liberal Blue and White party, led by Benny Gantz, former head of the Israel Defense Forces.

The election is a do-over after Netanyahu, Israel’s longest-serving leader, failed to form a coalition government despite winning a narrow victory in April’s vote.

Netanyahu has pursued a US-Israel mutual defense pact for months, seeing it as a way to boost his supporters’ enthusiasm as they head to the polls. He’s made national security the centerpiece of his campaign.

But Gantz has called the idea “a serious mistake” that would compromise Israeli independence.

Some of Trump’s key Republican supporters have also been pushing for such a deal.

“To destroy the one and only Jewish state, you have to come through us to get them,” Sen. Lindsey Graham (R-S.C.) said in April at the annual meeting of the Republican Jewish Coalition in Las Vegas.

On Saturday, Netanyahu heaped praise on Trump in the wake of his tweet.

“The Jewish State has never had a greater friend in the White House,” the prime minister posted on Twitter. “Together, we will continue full steam ahead with our common battle against terrorism.”