Lehman Brothers has agreed to pay $1.58 billion to take full control of apartment-company Archstone.

When Lehman Brothers led a leveraged buyout of apartment-company Archstone valued at $22 billion in 2007, it had a code name for the deal: “Project Easy Living.”

Ever since, it’s been anything but.

This week marks another chapter in the multi-year fallout from that peak-of-the-market deal, as Lehman Brothers Holdings — which emerged from bankruptcy under a liquidation plan earlier this year — has agreed to write a $1.58 billion check to partners Bank of America and Barclays for their remaining 26.5% stake in Archstone.

Nearly five years to the day since Lehman first signed up to buy Archstone, the deal appears to bring an end to nearly a year of sparring between Lehman and the two banks, which thought it was the time to sell. Lehman preferred a longer hold, likely for an initial public offering.

To be able to control Archstone’s destiny itself and simplify a complex ownership structure, the failed investment bank — with billions of cash on hand — had to pay up. Taken with an earlier deal in which it paid the two banks $1.33 billion, it’s now agreed to pay nearly $3 billion for Bank of America’s and Barclays’s full 53% stake in the company. And then there’s another $70 million to be paid directly to Equity Residential, which had been pursuing the company and pushing up the price.

For the next chapter, Lehman has a number of options for Archstone.

In the past, it’s considered taking the company public again. (Last summer it was readying papers for an initial public offering, according to people familiar with the matter.) In that scenario, it could either go it alone or bring in a partner. It has previously talked with Brookfield Asset Management, Blackstone Group, and pension funds including Canada’s Caisse de dépôt et placement du Québec and the Canadian Pension Plan Investment Board, according to people familiar with the matter.

Many analysts believe Archstone would benefit from selling some assets beforehand to reduce debt levels, which are considerably higher than typical public real-estate companies.

An IPO isn’t set in stone, and Lehman could theoretically pursue a merger, although it rejected bids last fall for the whole company. Lehman is controlled by a new board, which hasn’t disclosed its preference. “With full ownership of Archstone, we will now be able to move forward and pursue monetization opportunities for the company,” Owen Thomas, Lehman’s chairman, said in a statement issued this morning.

The fight has brought in its fair share of advisors as well. Lehman has been advised by Gleacher & Co. and Weil, Gotshal & Manges. Equity Residential was advised by Morgan Stanley, among others.