The Federal Reserve has dropped the hammer on Wells Fargo.

The Fed handed down unprecedented punishment late Friday for what it called the bank's "widespread consumer abuses," including its notorious creation of millions of fake customer accounts.

Wells Fargo won't be allowed to get any bigger than it was at the end of last year -- $2 trillion in assets -- until the Fed is satisfied that it has cleaned up its act.

Under pressure from the Fed, the bank agreed to remove three people from the board of directors by April and a fourth by the end of the year.

It is the first time the Federal Reserve has imposed a cap on the entire assets of a financial institution, according to a Fed official.

"We cannot tolerate pervasive and persistent misconduct at any bank," outgoing Fed Chairwoman Janet Yellen said in a statement. Friday was her last day on the job.

Wells Fargo (WFC) controls more money than any bank in the United States besides JPMorgan Chase, according to Fed data. But its reputation has been shattered over the past year and a half by a seemingly endless series of misconduct.

Most prominently, Wells Fargo admitted that its workers responded to wildly unrealistic sales goals by creating as many as 3.5 million fake accounts. The bank has also said it forced up to 570,000 customers into unneeded auto insurance.

The bank agreed to the Fed's conditions under what's known as a consent decree. In a statement, Wells Fargo said it is "confident" it can meet the Fed's requirements.

Related: Elizabeth Warren wants the Wells Fargo board wiped out

"We take this order seriously and are focused on addressing all of the Federal Reserve's concerns," said CEO Timothy Sloan, whose predecessor, John Stumpf, resigned a month after the fake-accounts scandal broke.

The Fed will require Wells Fargo to turn in detailed plans of what it has done, and intends to do, to fix the board. Wells Fargo must also submit a broader explanation for how it will improve its internal controls and its handling of risk. Those plans are due in 60 days.

By September 30, Wells Fargo must engage a third party to review how the bank is executing those plans.

Wells Fargo will still be able to accept consumer deposits and make loans to consumers, the Fed official said. However, it will be up to the bank to determine what changes may need to be made to its business in order to stay under the asset cap.

Wells Fargo stock fell more than 6% in after-hours trading Friday.

Sen. Elizabeth Warren, a Massachusetts Democrat and the most prominent of Wells Fargo's many critics in Congress, had begged Yellen to go after the board. Warren said in July that nothing would change at the big banks until "actual human beings are held accountable."

In a tweet Friday, Warren lauded Yellen for taking action and reiterated the case for tough regulation.

Chair Yellen's decision today to freeze the growth of Wells Fargo until it shapes up also demonstrates that we have the tools to rein in Wall Street -- if our regulators have the guts to use them. This one hits them where it hurts. — Elizabeth Warren (@SenWarren) February 3, 2018

"Chair Yellen's decision today to freeze the growth of Wells Fargo until it shapes up also demonstrates that we have the tools to rein in Wall Street -- if our regulators have the guts to use them," Warren wrote. "This one hits them where it hurts."

The scandal broke into public view in September 2016, when regulators revealed that Wells Fargo had created millions of bank accounts for customers without their knowledge. The company admitted the fake accounts dated back to 2009.

Since then, Wells Fargo has faced lawsuits, federal and state investigations, fines, and a grilling from Congress. The company ousted its CEO, John Stumpf, in October 2016. The number of customers opening new accounts at the bank plummeted. Workers alleged they were fired or retaliated against for speaking up about misbehavior.

Legal bills cost the company $3.3 billion last quarter, Wells Fargo said in January.

Related: I called the Wells Fargo ethics line and was fired

And the fake accounts aren't Wells Fargo's only problem.

Last July, the company admitted it forced auto insurance on as many as 570,000 borrowers who didn't need it. About 20,000 of those customers had their cars wrongfully repossessed in part due to these unwanted insurance charges.

In August, Wells Fargo was sued by small business owners who say the bank used deceptive language to dupe mom-and-pop businesses into paying "massive early termination fees."

The company was in the headlines again in October for charging about 110,000 mortgage borrowers undue fees.

The Justice Department fined the company in November for illegally repossessing cars from more than 860 service members. Federal law requires banks to get a court order before repossessing a car from members of the military.

--CNNMoney's Matt Egan contributed to this report.