JERUSALEM — The United States has finalized a $38 billion package of military aid for Israel over the next 10 years, the largest of its kind ever, and the two allies plan to sign the agreement on Wednesday, American and Israeli officials said.

The State Department scheduled a ceremony to formally announce the pact, which will be signed by Jacob Nagel, the acting national security adviser to Prime Minister Benjamin Netanyahu of Israel, and Thomas A. Shannon Jr., the under secretary of state for political affairs. Susan E. Rice, President Obama’s national security adviser who handled negotiations, plans to be on hand.

The package represents a major commitment to Israel’s security in the waning months of Mr. Obama’s presidency after years of fractious relations with Mr. Netanyahu over issues like the Iran nuclear agreement. Mr. Netanyahu agreed to several concessions to cement the deal rather than gamble on winning better terms from the next president.

The package will provide an average of $3.8 billion a year over the next decade to Israel, already the largest recipient of American aid, including financing for missile defense systems that defend against rockets fired by groups like Hezbollah and Hamas. Under a previous 10-year agreement that expires in 2018, the United States provides about $3 billion a year, but lately Congress has added up to $500 million a year for missile defense.