The United States on Wednesday signed an unprecedented new security agreement with Israel that will give the Israeli military $38 billion over 10 years.

The deal, the largest such agreement the U.S. has ever had with any country, amounts to $3.8 billion a year beginning in budget year 2019, compared with $3.1 billion the U.S. gave Israel annually under the current 10-year deal that expires in 2018.

"This commitment to Israel's security has been unwavering and is based on a genuine and abiding concern for the welfare of the Israeli people and the future of the state of Israel," President Barack Obama said in a statement.

After months of negotiations that took place after a particularly tense time in the relationship amid disputes over the Iran nuclear deal, the memorandum of understanding was signed at the State Department by Israel's national security adviser, Jacob Nagel, and Thomas Shannon, the third-highest ranking U.S. diplomat.

Obama's national security adviser Susan Rice, who witnessed the signing, called it a sign of Washington's "unshakable commitment" to the security of the Jewish state.

She said the agreements makes clear that the U.S. "will always be there for the state of Israel and its people today, tomorrow and for generations to come."

Nagel hailed the agreement as an indication of the "rock-solid alliance" between Israel and the United States.

"Israel has no better friend, no more reliable strategic ally, no more important partner than the United States of America," he said. "Everyone can see and feel the special relationship between our countries and our people."

Under the agreement, Israel's ability to spend part of the funds on Israeli military products will be phased out and eventually all of the money must be spent on American military industries. Israel's preference for spending some internally had been a major sticking point in the deal.

It also includes, for the first time, money for missile defense programs. Under the previous arrangement, Congress approved funds for missile defense separately and on an annual basis.

The new agreement eliminates Israel's ability to spend a fraction of the funds on fuel for its military. In another apparent concession, Israel has agreed not to ask Congress to approve more funds than are included in the deal unless a new war breaks out, said the officials, who weren't authorized to discuss the details publicly ahead of a formal announcement and who spoke on condition of anonymity.

The agreement concludes many months of negotiations that involved a delicate calculation by Israel about whether to strike a deal with the outgoing U.S. president. In February, Prime Minister Benjamin Netanyahu quietly floated the prospect of waiting for Obama's successor in hopes of securing a better deal.

But the Obama administration was eager to lock in the agreement before leaving office to help bolster Obama's legacy and undercut the criticism that his administration was insufficiently supportive of Israel.

Obama's relationship with Netanyahu has been tense for years, and ties between the countries worsened significantly when the U.S. and world powers struck the nuclear deal with Iran. Israel considers a nuclear-armed Iran to be an existential threat and disagreed sharply with Obama's contention that the deal actually made Israel safer by limiting Iran's nuclear program.