Wells Fargo & Co was slapped with a $3 billion penalty on Friday by federal authorities furious over the millions of bogus accounts created at the beleaguered financial institution in the last few years.

Wells Fargo has agreed to resolve criminal and civil investigations into fraudulent sales transactions and has admitted to forcing personnel in a fake accounts controversy, US officials said, wrapping up one of the final major probe looming over the lender.

Since the bogus-accounts scandal erupted in 2016, Wells Fargo has paid out billions in dollars of fines to federal regulators, revamped its board of directors and witnessed two chief executives and other senior ranking executives leave the bank.

The $3 billion payment will include a $500 million civil settlement to the Securities and Exchange Commission, which will allocate the fees to investors who were affected by Wells' illicit practices. Prosecutors condemned the bank for the "staggering size and duration" of its unlawful behavior uncovered at one of the United States' biggest and most influential banks.

From 2002 to 2016, bank staff used fraudulent means to meet huge -- and sometimes impossible -- sales quotas. They created millions of accounts under clients' names without their consent, signed up unsuspecting customer accounts for credit cards and bill payments, faked signatures and even secretly transferred clients' money online.

Wells Fargo will enter into a 3-year deferred prosecution deal during which the San Francisco-headquartered bank will continue to cooperate with any ongoing federal probe, Department of Justice officials disclosed.

According to Stephanie Avakian, co-chief of the SEC's enforcement unit, the bank has "repeatedly misled investors about what it claims to be the foundation of its community bank business model and its capacity to increase profits and revenue."

In a statement, North Carolina district attorney Andrew Murray said that the announcement should serve as a stark reminder that no finance organization is "too powerful, or too well-known to be held responsible and face the consequences for its wrongdoings."

Charles Scharf, Wells Fargo's new chief executive officer, described Wells Fargo's misconduct as "reprehensible." Wells Fargo is the fourth biggest lender in the United States. Senior executives within the bank's Community Bank Division had knowledge of the unlawful and unethical behavior as early as 2002, and many of these were referred to as "gaming" within the organization, authorities said.

Wells Fargo also disclosed that it has scrapped all product-based sales productions, revised its pay based on client transaction results and bolstered customer approval and oversight policies. The bank's settlement, which weighs on revenue growth in the near-term, shows signs that its corporate team is on course to reconciling with federal authorities over its unlawful sales behavior, analysts said.