CHARLOTTE, N.C. — Bank of America's board of directors chose consumer banking chief Brian Moynihan to replace Ken Lewis as CEO on Jan. 1.

Their pick of an internal candidate on Wednesday followed a months-long search and unsuccessful attempts to hire a star industry executive for the top job at the nation's largest bank. The negotiations were complicated by pay restrictions imposed by government pay czar Kenneth Feinberg before the bank repaid $45 billion of federal bailout loans needed to prevent its failure last year.

The move "draws to a close what is probably the executive search from hell," said Tony Plath, a finance professor at the University of North Carolina at Charlotte. "They needed to find someone to end the drama so that the bank can get back to regular business, but at the same time I am surprised by their choice. You do have a young and untested CEO running a major commercial bank in the U.S."

Moynihan, 50, joined the bank, based in Charlotte, N.C., as part of its 2004 purchase of FleetBoston Financial Corp. Over the past year he has served as BofA general counsel, head of global wealth management and consumer bank chief. He also will now join the bank's board of directors.

"I am honored to have the opportunity to lead this important company," Moynihan said in a statement. "We have everything we need at Bank of America to be the best financial services company in the world. What we need to do now is very simple. We need to execute."

As the new CEO, Moynihan faces many daunting tasks. He must juggle regulatory investigations into the bank's 2008 acquisition of Merrill Lynch while trying to repair relationship with regulators and members of Congress who sharply criticized Lewis after the bank required billions in aid. Some of those lawmakers, including Maryland Democrat Rep. Elijah Cummings, had also questioned Moynihan's leadership skills during a hearing on the Merrill takeover.

"Brian's wide range of experience, his relationships inside and outside of the company, and his demonstrated ability to understand business dynamics and effect constructive change made him the best person for the position," said Dr. Walter E. Massey, chairman of Bank of America, who led the CEO search.

Bank of America told the Treasury Department of its decision before making the announcement, and Treasury raised no objections, according to industry officials familiar with the matter. They spoke on condition of anonymity because the bank's discussions were private.

Lewis, 62, announced his departure in September in a move that surprised Bank of America's board and left it scrambling for a replacement with no clear succession plan in place. Before then, Lewis had promised he would remain as CEO until the bank cleared up its financial problems.