Bank of America Corp shareholders voted to oust Chief Executive Kenneth Lewis as chairman of the board on Wednesday after months of mounting criticism of his stewardship of the largest U.S. bank.

The bank's board unanimously expressed support for Lewis to stay in the CEO post despite the fact that shareholders narrowly approved a proposal to require an independent chairman.

Lewis, who will remain chief executive, will be replaced in the chairman post by Walter Massey, a director of the bank's board since 1998 and also a director of McDonald's Corp .

Earlier, at a nearly four-hour annual meeting, Lewis withstood dozens of attacks from shareholders over his leadership, and in particular the bank's controversial purchase of Merrill Lynch & Co, but also got substantial praise.

The meeting in uptown Charlotte, North Carolina, where the bank is based, attracted about 2,000 people, more than triple the year-earlier number. It reflected how the bank's shareholders are torn over the man responsible for much of Bank of America's growth, as well as its current troubles.

Lewis did withstand a push from many shareholders to kick him off the board, as shareholders elected all 18 director nominees by a clear margin, people familiar with the matter said. The people were not authorized to speak publicly.

The 62-year-old Lewis fielded many complaints over the bank's failure to quickly disclose huge losses that Merrill was amassing, as it was paying out billions of dollars of bonuses to employees. Bank of America's shares have fallen by about three-fourths since the merger was announced in September.

Judy Koenick, who said she lost $27,000 on the bank's stock -- and wore a shirt saying Fire them all!!! Kenneth Lewis, & the board of directors, make a clean sweep -- told Lewis that he and his board should have stood up to any government pressure to buy Merrill, even if it cost them their jobs.

I don't understand how a code of ethics allows you to say, 'My job is more important,' she said. You knew what was going on with Merrill Lynch, you kept it from us. You're still keeping it from us.

Lewis stood patiently behind a podium on a stage for much of the meeting, often twiddling his thumbs or biting his lip as shareholders vented their frustration.

Others were more supportive. A 92-year-old man who said he owned a half million shares, said that in buying Merrill and the troubled mortgage lender Countrywide Financial Corp, Lewis believed he was doing something good for America. The man added: If we don't have Ken, who do we have?

LEWIS DEFENDS MERRILL PURCHASE

In a speech, Lewis defended buying Merrill for $29.1 billion of common and preferred stock, saying that it was good value and that abandoning the deal would have caused serious harm to Bank of America and other banks. He also said he saw no need for Bank of America to make further acquisitions.

Bank of America needed a $20 billion federal bailout to absorb Merrill. Lewis has indicated that regulators pushed him to keep quiet about Merrill's losses and not to back out of the merger. He told shareholders that as a legal matter, there was no duty to disclose the bank's talks with the government.

They should have disclosed it, said Ed Morais, a financial adviser and shareholder from Charlotte attending his first annual meeting. It seems like he chose to put Merrill Lynch shareholders ahead of Bank of America shareholders. He spoke before the meeting.

Citing shareholder lawsuits, Lewis declined to comment on thornier issues surrounding the purchase, which is the subject of investigations by members of the U.S. Congress as well as regulators including the U.S. Securities and Exchange Commission and New York Attorney General Andrew Cuomo.

Bank of America has received a total of $45 billion in taxpayer funds and may need more after results of government stress tests are released, probably next week. The tests gauge banks' ability to weather a deep recession.

Lewis declined to discuss details of talks with regulators about the tests, including whether the bank might need to issue more common stock to bolster capital.

SEVERAL BIG MERGERS

Since becoming chief executive in 2001, Lewis has spent well over $100 billion on big acquisitions including Merrill, FleetBoston Financial Corp, credit card issuer MBNA Corp, and, last July, mortgage lender Countrywide Financial Corp.

Critics say Lewis often appears interested in making Bank of America bigger rather than better.

But Lewis said the board's decision to buy Merrill was not about a selfish desire to keep our jobs.

I can state without reservation that these acquisitions are not mistakes to be regretted, he said.

Shares of Bank of America rose 53 cents, or 6.5 percent to close at $8.68 on the New York Stock Exchange.

(Reporting by Jonathan Stempel; additional reporting by Elinor Comlay and Dan Wilchins; editing by John Wallace and Gerald E. McCormick)