Image copyright AFP Image caption Israeli Prime Minister Benjamin Netanyahu initially sought a deal worth up to $4.5bn

The US has agreed a military aid package for Israel worth $38bn (£28bn) over the next 10 years, officials say, the largest such deal in US history.

The previous pact, set to expire in 2018, saw Israel get $3.1bn annually.

The new agreement follows 10 months of behind-the-scenes talks and will be signed on Wednesday.

Pro-Palestinian groups criticised the deal, saying it rewards Israel despite the ongoing construction in Jewish settlements in the occupied West Bank.

A pro-Israel lobby group, the American Israel Public Affairs Committee, said the deal would send a "strong message of deterrence" to Israel's enemies.

Last month, the White House warned that the construction in settlements posed a "serious and growing threat to the viability of a two-state solution" to the Israeli-Palestinian conflict.

The settlements are considered illegal under international law, though Israel disputes this.

Image copyright AP Image caption Israel has agreed not to lobby the US Congress for additional funds unless a war breaks out

A brief statement issued by the US state department on Tuesday said the new memorandum of understanding with Israel on security assistance, running from 2019 until 2028, constituted "the single largest pledge of bilateral military assistance in US history".

Officials said the new package would for the first time incorporate money - $500m a year - for Israeli missile defence programmes. They were previously funded on an annual basis by Congress.

Israel had agreed not to lobby Congress for additional funds during the lifetime of the deal unless a new war broke out, the officials said.

The pact also reportedly includes an undertaking that Israel will eventually only use the money to buy products from the US defence industry, rather than its own.

Image copyright Getty Images Image caption President Obama and Prime Minister Netanyahu have not always seen eye-to-eye

Israel will no longer be able to spend some of the funds on fuel for its military too.

US President Barack Obama had been keen to strike a deal before leaving office to counter criticism that his administration had been insufficiently supportive of a key ally's security.

Israeli Prime Minister Benjamin Netanyahu had signalled that he might wait for Mr Obama's successor in the hope of securing a better deal worth up to $4.5bn a year.

Relations have been strained between the two leaders for years, and worsened in March 2015 when Mr Netanyahu appeared before Congress to lobby against the Iran nuclear deal advocated by Mr Obama.

Hillary Clinton, the Democratic candidate for US president, applauded the deal saying it will "help solidify and chart a course for the US-Israeli defense relationship into the 21st century".

Mr Obama and Mr Netanyahu are expected to address the UN General Assembly in New York next week, but no plans for a formal meeting have been announced.