Astoria Financial Corp. said Tuesday it has agreed to be acquired by Montebello, New York-based Sterling Bancorp in an all-stock deal worth $2.2 billion.

The combined bank will have about $29 billion in assets and $19 billion in deposits.

The announcement of the deal comes less than three months after Lake Success-based Astoria Financial’s deal to be taken over by New York Community Bancorp was terminated.

The two companies didn’t disclose why that deal, valued at $2 billion when it was announced in 2015, was called off.

Astoria is the most recent Long Island-based bank to agree to sell itself to a bank based elsewhere.

People’s Bank, of Bridgeport, Connecticut, agreed to purchase Suffolk County National Bank for about $402 million in June 2016. That deal is waiting for approval from the Federal Reserve’s Board of Governors.

Sterling said it expects its purchase of Astoria to close by the end of this year. It added that Astoria Financial’s 88 branches will be rebranded as Sterling National Bank.

advertisement | advertise on newsday

Sterling Bancorp has 40 branches in New York State. It has a branch in Great Neck, as well as a payroll finance group in Woodbury and a commercial financial center in Melville, according to the company’s website.

Sterling said it would close up to 20 percent of the combined company’s branches and other back-office locations “over time.” It did not disclose which branches would close.

Sterling, which has made three smaller bank purchases since 2011, said it would take up to two years to fully integrate Astoria Financial, which has $14.6 billion in assets.

The banks said the merger would lead to $100 million in annual cost savings.

Astoria shares closed at $20.65, up 12 percent yesterday. The shares are up 31 percent in the last year.

Sterling Bancorp shares fell 5 percent to $23.85. They are up nearly 55 percent in the past 12 months.