President Donald Trump announced on Tuesday that the United States will stop providing Israel with approximately $4 billion in annual military aid by the end of the year.

He made the announcement by phone to Fox News as polls opened across the United States for midterm elections. Trump said Israel no longer needed the funding but that Washington would continue selling arms to its closest Middle East ally. He said Israeli Prime Minister Benjamin Netanyahu had come to him with the idea and that they had discussed it for months.

"Look, we give them $4 billion of things and money, and they don't need it," Trump said. "Now, as far as paying Israel, Bibi Netanyahu and I have made a deal that we give Israel $4 billion a year, and we made a deal months ago that we're stopping," he added. "We've already agreed that by the end of this year we won't be paying Israel. Now we'll help Israel if they need it."

Trump tied the decision to the election campaign. He said the aid had become too easy a target for critics such as Abdul El-Sayed, a Democrat and outspoken critic of Israel who is running for the Senate in Michigan. He said some Democrats and left-wing politicians were using US financial support to Israel to criticize Republicans. Analysts suggested his declaration was timed as an Election Day ploy.

The current 10-year, $38 billion agreement was signed in 2016 under President Barack Obama and runs until 2028. It provides $3.3 billion annually in military financing and $500 million for joint missile defense programs. Trump did not provide details on how the funding would be halted before the memorandum of understanding expires in September 2028.

Israeli officials expressed surprise at the announcement, and the Finance Ministry was reportedly caught off guard, according to the news website Ynet. Netanyahu's office did not immediately comment. Gadi Eisenkot, Netanyahu's main rival, said it was dangerous that Israel's defense establishment had learned of the change through the media and called for the prime minister to be replaced.

Yair Golan, leader of Israel's Democrats party, accused Netanyahu of an "enormous failure." Golan warned that ending US assistance would seriously damage Israel's security and place the burden of financing military needs entirely on Israeli citizens. He said Israel's air defense capabilities have been depleted after prolonged conflict.

Opinion polls show US public support for Israel has declined since the Gaza war. A Quinnipiac University poll in June found 48 percent of voters and 66 percent of Democrats believe the US is too supportive of Israel.